Skip to main content

BoxPlotOpts

Struct BoxPlotOpts 

Source
pub struct BoxPlotOpts { /* private fields */ }

Implementations§

Source§

impl BoxPlotOpts

Source

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
Hide additional 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}
Source

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
Hide additional 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}
Source

pub fn box_width(self, w: f64) -> Self

Source

pub fn whisker_iqr(self, k: f64) -> Self

Source

pub fn stroke_width(self, w: f64) -> Self

Trait Implementations§

Source§

impl Debug for BoxPlotOpts

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BoxPlotOpts

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.