Skip to main content

BoxPlotArtist

Struct BoxPlotArtist 

Source
pub struct BoxPlotArtist {
    pub stats: Vec<BoxStats>,
    pub labels: Vec<String>,
    pub color: Color,
    pub label: Option<String>,
    pub alpha: f64,
    pub box_width: f64,
    pub show_outliers: bool,
    pub whisker_iq_factor: f64,
    pub raw_data: Vec<Vec<f64>>,
}
Expand description

A box-and-whisker plot showing distribution summaries for one or more groups of data.

Each group produces a box spanning Q1 to Q3 with a median line, whiskers extending to the most extreme data points within the configured fence, and optional outlier dots beyond the whiskers.

Fields§

§stats: Vec<BoxStats>

Pre-computed summary statistics for each group.

§labels: Vec<String>

Category labels for the x-axis (one per group).

§color: Color

Fill color of the boxes.

§label: Option<String>

Optional legend label.

§alpha: f64

Opacity from 0.0 (fully transparent) to 1.0 (fully opaque).

§box_width: f64

Box width as a fraction of the category spacing.

§show_outliers: bool

Whether to draw outlier dots.

§whisker_iq_factor: f64

Whisker extent as a multiple of IQR.

§raw_data: Vec<Vec<f64>>

Raw data retained for re-computing stats when parameters change.

Implementations§

Source§

impl BoxPlotArtist

Source

pub fn data_bounds(&self) -> (f64, f64, f64, f64)

Computes the data-space bounding box (xmin, xmax, ymin, ymax).

The x-axis spans from -0.5 to n - 0.5 (where n is the number of groups), centering each box on an integer position. The y-axis spans from the lowest whisker (or outlier) to the highest.

Source§

impl BoxPlotArtist

Source

pub fn color(&mut self, color: Color) -> &mut Self

Sets the box fill color.

Applies the given Color to every box rendered by this artist.

Source

pub fn label(&mut self, label: &str) -> &mut Self

Sets the legend label.

When a legend is displayed on the figure, this label will appear next to the color swatch for this box plot.

Source

pub fn alpha(&mut self, alpha: f64) -> &mut Self

Sets the opacity.

The value is clamped to the range [0.0, 1.0], where 0.0 is fully transparent and 1.0 is fully opaque.

Source

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

Sets the box width as a fraction of the category spacing.

Smaller values produce thinner boxes with more whitespace between them. The value is clamped to [0.1, 1.0].

Source

pub fn show_outliers(&mut self, show: bool) -> &mut Self

Controls whether outlier points are drawn.

When true (the default), data points beyond the whiskers are rendered as individual dots. When false, outliers are hidden.

Source

pub fn whisker_factor(&mut self, factor: f64) -> &mut Self

Sets the whisker extent factor.

Whiskers extend from Q1 and Q3 by this factor multiplied by the interquartile range (IQR). The standard value is 1.5. Changing this value recomputes the box statistics from the stored raw data.

Trait Implementations§

Source§

impl Clone for BoxPlotArtist

Source§

fn clone(&self) -> BoxPlotArtist

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BoxPlotArtist

Source§

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

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.