Movatterモバイル変換


[0]ホーム

URL:


Docs.rs

StructBoxplot

Source
pub struct Boxplot {/* private fields */ }
Expand description

Draw a box and whisker plot

See Matplotlib’s documentation

§Examples

§Data as a nested list

useplotpy::{Boxplot, Plot, StrError};fnmain() ->Result<(), StrError> {// data (as a nested list)letdata =vec![vec![1,2,3,4,5],// Avec![2,3,4,5,6,7,8,9,10],// Bvec![3,4,5,6],// Cvec![4,5,6,7,8,9,10],// Dvec![5,6,7],// E];// x ticks and labelsletn = data.len();letticks: Vec<_> = (1..(n +1)).into_iter().collect();letlabels = ["A","B","C","D","E"];// boxplot object and optionsletmutboxes = Boxplot::new();    boxes.draw(&data);// save figureletmutplot = Plot::new();    plot.add(&boxes)        .set_title("boxplot documentation test")        .set_ticks_x_labels(&ticks,&labels)        .save("/tmp/plotpy/doc_tests/doc_boxplot_2.svg")?;Ok(())}

doc_boxplot_2.svg

§Data as a 2D array

useplotpy::{Boxplot, Plot, StrError};fnmain() ->Result<(), StrError> {// data (as a 2D array/matrix)letdata =vec![//   A  B  C  D  Evec![1,2,3,4,5],vec![2,3,4,5,6],vec![3,4,5,6,7],vec![4,5,6,7,8],vec![5,6,7,8,9],vec![6,7,8,9,10],vec![14,14,14,14,14],// fliers];// x ticks and labelsletncol = data[0].len();letticks: Vec<_> = (1..(ncol +1)).into_iter().collect();letlabels = ["A","B","C","D","E"];// boxplot object and optionsletmutboxes = Boxplot::new();    boxes.draw_mat(&data);// save figureletmutplot = Plot::new();    plot.add(&boxes)        .set_title("boxplot documentation test")        .set_ticks_x_labels(&ticks,&labels)        .save("/tmp/plotpy/doc_tests/doc_boxplot_1.svg")?;Ok(())}

doc_boxplot_1.svg

§More examples

See also integration test in thetests directory.

Implementations§

Source§

implBoxplot

Source

pub fnnew() -> Self

Creates a new Boxplot object

Source

pub fndraw<T>(&mut self, data: &Vec<Vec<T>>)
where T:Display +Num,

Draws the box plot given a nested list

§Input
  • data – Is a sequence of 1D arrays such that a boxplot is drawn for each array in the sequence.From Matplotlib
Source

pub fndraw_mat<'a, T, U>(&mut self, data:&'a T)
where T:AsMatrix<'a, U>, U: 'a +Display +Num,

Draws the box plot given a 2D array (matrix)

§Input
  • data – Is a 2D array (matrix) such that a boxplot is drawn for each column in the matrix.From Matplotlib
Source

pub fnset_symbol(&mut self, symbol: &str) -> &mut Self

Sets the symbol for the fliers

Source

pub fnset_horizontal(&mut self, flag:bool) -> &mut Self

Enables drawing horizontal boxes

Source

pub fnset_whisker(&mut self, whisker:f64) -> &mut Self

Sets the position of the whiskers

The default value of whisker = 1.5 corresponds to Tukey’s original definition of boxplots.

See Matplotlib’s documentation

Source

pub fnset_positions(&mut self, positions: &[f64]) -> &mut Self

Sets the positions of the boxes

Source

pub fnset_width(&mut self, width:f64) -> &mut Self

Sets the width of the boxes

Source

pub fnset_no_fliers(&mut self, flag:bool) -> &mut Self

Disables the fliers

Source

pub fnset_patch_artist(&mut self, flag:bool) -> &mut Self

Enables the use of Patch artist to draw boxes instead of Line2D artist

Source

pub fnset_medianprops(&mut self, props: &str) -> &mut Self

Set the median properties.

See Matplotlib’s documentation

Source

pub fnset_boxprops(&mut self, props: &str) -> &mut Self

Set the properties of the box

Source

pub fnset_whiskerprops(&mut self, props: &str) -> &mut Self

Set the properties of the whisker

Source

pub fnset_extra(&mut self, extra: &str) -> &mut Self

Sets extra matplotlib commands (comma separated)

Important: The extra commands must be comma separated. For example:

param1=123,param2='hello'

See Matplotlib’s documentation for extra parameters

Trait Implementations§

Source§

implGraphMaker forBoxplot

Source§

fnget_buffer<'a>(&'a self) -> &'aString

Returns the text buffer with Python3 commands
Source§

fnclear_buffer(&mut self)

Clear the text buffer with Python commands

Auto Trait Implementations§

§

implFreeze forBoxplot

§

implRefUnwindSafe forBoxplot

§

implSend forBoxplot

§

implSync forBoxplot

§

implUnpin forBoxplot

§

implUnwindSafe forBoxplot

Blanket Implementations§

Source§

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

Source§

fntype_id(&self) ->TypeId

Gets theTypeId ofself.Read more
Source§

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

Source§

fnborrow(&self) ->&T

Immutably borrows from an owned value.Read more
Source§

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

Source§

fnborrow_mut(&mut self) ->&mut T

Mutably borrows from an owned value.Read more
Source§

impl<T>From<T> for T

Source§

fnfrom(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fninto(self) -> U

CallsU::from(self).

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

Source§

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

Source§

typeError =Infallible

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

fntry_from(value: U) ->Result<T, <T asTryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

typeError = <U asTryFrom<T>>::Error

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

fntry_into(self) ->Result<U, <U asTryFrom<T>>::Error>

Performs the conversion.

[8]ページ先頭

©2009-2025 Movatter.jp