pub struct BoxPlotOpts { /* private fields */ }Implementations§
Source§impl BoxPlotOpts
impl BoxPlotOpts
Sourcepub fn label(self, s: impl Into<String>) -> Self
pub fn label(self, s: impl Into<String>) -> Self
Examples found in repository?
examples/gen_hero_svgs.rs (line 279)
261fn boxplot() -> String {
262 let control: Vec<f64> = (0..30)
263 .map(|i| 5.0 + ((i as f64 * 0.43) % 1.0 - 0.5) * 3.0)
264 .collect();
265 let mut treated: Vec<f64> = (0..30)
266 .map(|i| 7.0 + ((i as f64 * 0.71 + 0.1) % 1.0 - 0.5) * 4.0)
267 .collect();
268 treated.push(15.0);
269
270 let groups = vec![
271 ("control".to_string(), control),
272 ("treated".to_string(), treated),
273 ];
274
275 Figure::new()
276 .size(PaperSize::A5Landscape)
277 .title("Distribution by group")
278 .ylabel("response")
279 .boxplot(&groups, |b| b.hatch(Hatch::Diagonal).label("Q1–Q3"))
280 .legend_top_right()
281 .to_svg()
282}More examples
examples/boxplot.rs (line 22)
3fn main() {
4 // Synthetic samples per group.
5 let control: Vec<f64> = (0..30)
6 .map(|i| 5.0 + ((i as f64 * 0.43) % 1.0 - 0.5) * 3.0)
7 .collect();
8 let mut treated: Vec<f64> = (0..30)
9 .map(|i| 7.0 + ((i as f64 * 0.71 + 0.1) % 1.0 - 0.5) * 4.0)
10 .collect();
11 treated.push(15.0); // outlier
12
13 let groups = vec![
14 ("control".to_string(), control),
15 ("treated".to_string(), treated),
16 ];
17
18 let fig = Figure::new()
19 .size(PaperSize::A5Landscape)
20 .title("Distribution by group")
21 .ylabel("response")
22 .boxplot(&groups, |b| b.hatch(Hatch::Diagonal).label("Q1–Q3"))
23 .legend_top_right();
24
25 std::fs::create_dir_all("out").expect("create out/");
26 std::fs::write("out/boxplot.svg", fig.to_svg()).expect("write svg");
27 println!("wrote out/boxplot.svg");
28}Sourcepub fn hatch(self, h: Hatch) -> Self
pub fn hatch(self, h: Hatch) -> Self
Examples found in repository?
examples/gen_hero_svgs.rs (line 279)
261fn boxplot() -> String {
262 let control: Vec<f64> = (0..30)
263 .map(|i| 5.0 + ((i as f64 * 0.43) % 1.0 - 0.5) * 3.0)
264 .collect();
265 let mut treated: Vec<f64> = (0..30)
266 .map(|i| 7.0 + ((i as f64 * 0.71 + 0.1) % 1.0 - 0.5) * 4.0)
267 .collect();
268 treated.push(15.0);
269
270 let groups = vec![
271 ("control".to_string(), control),
272 ("treated".to_string(), treated),
273 ];
274
275 Figure::new()
276 .size(PaperSize::A5Landscape)
277 .title("Distribution by group")
278 .ylabel("response")
279 .boxplot(&groups, |b| b.hatch(Hatch::Diagonal).label("Q1–Q3"))
280 .legend_top_right()
281 .to_svg()
282}More examples
examples/boxplot.rs (line 22)
3fn main() {
4 // Synthetic samples per group.
5 let control: Vec<f64> = (0..30)
6 .map(|i| 5.0 + ((i as f64 * 0.43) % 1.0 - 0.5) * 3.0)
7 .collect();
8 let mut treated: Vec<f64> = (0..30)
9 .map(|i| 7.0 + ((i as f64 * 0.71 + 0.1) % 1.0 - 0.5) * 4.0)
10 .collect();
11 treated.push(15.0); // outlier
12
13 let groups = vec![
14 ("control".to_string(), control),
15 ("treated".to_string(), treated),
16 ];
17
18 let fig = Figure::new()
19 .size(PaperSize::A5Landscape)
20 .title("Distribution by group")
21 .ylabel("response")
22 .boxplot(&groups, |b| b.hatch(Hatch::Diagonal).label("Q1–Q3"))
23 .legend_top_right();
24
25 std::fs::create_dir_all("out").expect("create out/");
26 std::fs::write("out/boxplot.svg", fig.to_svg()).expect("write svg");
27 println!("wrote out/boxplot.svg");
28}pub fn box_width(self, w: f64) -> Self
pub fn whisker_iqr(self, k: f64) -> Self
pub fn stroke_width(self, w: f64) -> Self
Trait Implementations§
Source§impl Debug for BoxPlotOpts
impl Debug for BoxPlotOpts
Auto Trait Implementations§
impl Freeze for BoxPlotOpts
impl RefUnwindSafe for BoxPlotOpts
impl Send for BoxPlotOpts
impl Sync for BoxPlotOpts
impl Unpin for BoxPlotOpts
impl UnsafeUnpin for BoxPlotOpts
impl UnwindSafe for BoxPlotOpts
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more