MCPcopy Index your code
hub / github.com/cpmech/plotpy / test_boxplot_2

Function test_boxplot_2

tests/test_boxplot.rs:56–94  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54
55#[test]
56fn test_boxplot_2() -> Result<(), StrError> {
57 let data = vec![
58 vec![1, 2, 3, 4, 5], // A
59 vec![2, 3, 4, 5, 6, 7, 8, 9, 10], // B
60 vec![3, 4, 5, 6], // C
61 vec![4, 5, 6, 7, 8, 9, 10], // D
62 vec![5, 6, 7], // E
63 ];
64
65 let positions = [2.0, 2.5, 3.0, 3.5, 4.0];
66 let labels = ["A", "B", "C", "D", "E"];
67
68 // boxplot object and options
69 let mut boxes = Boxplot::new();
70 boxes
71 .set_symbol("b.")
72 .set_horizontal(true)
73 .set_positions(&positions)
74 .set_width(0.45)
75 .draw(&data);
76
77 let mut plot = Plot::new();
78 plot.add(&boxes)
79 .set_inv_y()
80 .set_title("boxplot integration test")
81 .set_ticks_y_labels(&positions, &labels);
82
83 // save figure
84 let path = Path::new(OUT_DIR).join("integ_boxplot_2.svg");
85 plot.save(&path)?;
86
87 // check number of lines
88 let file = File::open(path).map_err(|_| "cannot open file")?;
89 let buffered = BufReader::new(file);
90 let lines_iter = buffered.lines();
91 let c = lines_iter.count();
92 assert!(c > 950 && c < 1000);
93 Ok(())
94}
95
96#[test]
97fn test_boxplot_3() -> Result<(), StrError> {

Callers

nothing calls this directly

Calls 10

set_positionsMethod · 0.80
set_symbolMethod · 0.80
set_ticks_y_labelsMethod · 0.80
set_inv_yMethod · 0.80
saveMethod · 0.80
drawMethod · 0.45
set_widthMethod · 0.45
set_horizontalMethod · 0.45
set_titleMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected