MCPcopy Create free account
hub / github.com/cpmech/plotpy / test_boxplot_4

Function test_boxplot_4

tests/test_boxplot.rs:142–183  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

140
141#[test]
142fn test_boxplot_4() -> Result<(), StrError> {
143 let data = vec![
144 vec![1, 2, 3, 4, 5, 10], // A
145 vec![2, 3, 4, 5, 6, 7, 8, 9, 10], // B
146 vec![3, 4, 5, 6, 10], // C
147 ];
148
149 let ticks = [1, 2, 3];
150 let labels = ["A", "B", "C"];
151
152 let mut b1 = Boxplot::new();
153 b1.draw(&data);
154
155 let mut b2 = Boxplot::new();
156 b2.set_symbol("b+").draw(&data);
157
158 let mut b3 = Boxplot::new();
159 b3.set_symbol("b+").set_no_fliers(true).draw(&data);
160
161 let mut plot = Plot::new();
162 plot.set_vertical_gap(0.0)
163 .set_subplot(3, 1, 1)
164 .add(&b1)
165 .set_subplot(3, 1, 2)
166 .add(&b2)
167 .set_subplot(3, 1, 3)
168 .add(&b3)
169 .set_ticks_x_labels(&ticks, &labels)
170 .set_figure_size_points(300.0, 450.0);
171
172 // save figure
173 let path = Path::new(OUT_DIR).join("integ_boxplot_4.svg");
174 plot.save(&path)?;
175
176 // check number of lines
177 let file = File::open(path).map_err(|_| "cannot open file")?;
178 let buffered = BufReader::new(file);
179 let lines_iter = buffered.lines();
180 let c = lines_iter.count();
181 assert!(c > 1020 && c < 1100);
182 Ok(())
183}
184
185#[test]
186fn test_boxplot_5() -> Result<(), StrError> {

Callers

nothing calls this directly

Calls 9

set_symbolMethod · 0.80
set_no_fliersMethod · 0.80
set_ticks_x_labelsMethod · 0.80
set_subplotMethod · 0.80
set_vertical_gapMethod · 0.80
saveMethod · 0.80
drawMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected