Skip to main content

GeomBoxplot

Struct GeomBoxplot 

Source
pub struct GeomBoxplot {
Show 15 fields pub fill: (u8, u8, u8), pub color: (u8, u8, u8), pub width: f64, pub alpha: f64, pub notch: bool, pub notch_width: f64, pub varwidth: bool, pub coef: f64, pub outliers: bool, pub outlier_color: Option<(u8, u8, u8)>, pub outlier_shape: PointShape, pub outlier_filled: bool, pub outlier_size: f64, pub outlier_alpha: f64, pub staple_width: f64,
}
Expand description

Boxplot geometry (ggplot2’s geom_boxplot).

Fields§

§fill: (u8, u8, u8)§color: (u8, u8, u8)§width: f64§alpha: f64§notch: bool

Notched box: the sides pinch in to notch_width of the box at the median, spanning median ± 1.58·IQR/√n (notch = TRUE).

§notch_width: f64

Box width at the notch, relative to the box (notchwidth, 0.5).

§varwidth: bool

Box width ∝ √n of the group (varwidth = TRUE).

§coef: f64

Whisker reach in IQRs passed to the default stat (coef, 1.5).

§outliers: bool

Draw the outlier points (outliers = FALSE hides them).

§outlier_color: Option<(u8, u8, u8)>

Outlier point colour; None = the box outline colour.

§outlier_shape: PointShape

Outlier point shape (outlier.shape; default an open circle).

§outlier_filled: bool

Fill outlier points (outlier.shape = 19-like) instead of outlining.

§outlier_size: f64

Outlier point radius in px (outlier.size).

§outlier_alpha: f64

Outlier point opacity (outlier.alpha).

§staple_width: f64

Whisker end-cap width relative to the box (staplewidth; 0 = none). ggplot2’s default is 0; ggplot-rs keeps its historical 0.5 caps.

Implementations§

Source§

impl GeomBoxplot

Source

pub fn notched(self) -> Self

notch = TRUE.

Source

pub fn varwidth(self) -> Self

varwidth = TRUE.

Source

pub fn with_coef(self, coef: f64) -> Self

coef — whisker reach in IQRs.

Source

pub fn hide_outliers(self) -> Self

outliers = FALSE: no outlier points, and they don’t widen the y scale.

Source

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

staplewidth — whisker cap width relative to the box (0 = none).

Trait Implementations§

Source§

impl Clone for GeomBoxplot

Source§

fn clone(&self) -> Self

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 GeomBoxplot

Source§

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

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

impl Default for GeomBoxplot

Source§

fn default() -> Self

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

impl Geom for GeomBoxplot

Source§

fn default_position(&self) -> Box<dyn Position>

ggplot2’s default: grouped boxes sit side by side in their x slot.

Source§

fn setup_data(&self, data: &mut DataFrame, warnings: &mut Vec<String>)

B3-5: normalise the outliers cell (strip brackets, drop unparsable parts with one warning) and widen ymin_final/ymax_final to include every outlier, so the y scale trains on the full extent (allowed #6) instead of silently clipping outliers that fall outside the whiskers.

Source§

fn draw( &self, data: &DataFrame, coord: &dyn Coord, scales: &ScaleSet, _theme: &Theme, backend: &mut dyn DrawBackend, ) -> Result<(), RenderError>

Draw this geometry.
Source§

fn required_aes(&self) -> Vec<Aesthetic>

Required aesthetics.
Source§

fn default_stat(&self) -> Box<dyn Stat>

Default stat for this geom.
Source§

fn default_params(&self) -> GeomParams

Non-mapped visual defaults.
Source§

fn name(&self) -> &str

Name for debug/display.
Source§

fn apply_element_geom(&mut self, el: &ElementGeom)

Recolour this geom’s built-in default colour/fill from the theme’s ink/paper/accent palette (B2-7’s element_geom), called once per layer before set_series_color — and only when the layer was not configured explicitly (geom_*_with(...); the build pipeline gates the call on the same explicit_style flag set_series_color’s brand-colour application is gated on). That gate, not a field-value comparison, is what keeps an explicit colour untouched: a geom that honours this replaces a field still at its own hard-coded default (black/(50, 50, 50) → ink, white → paper) by comparing its value, which cannot by itself tell an explicitly-set colour that happens to equal that default (e.g. GeomPoint { color: (0, 0, 0), .. } under geom_point_with) apart from one that was simply never touched — only skipping the call entirely for an explicitly-configured layer closes that gap (review PR#141 finding 4). Default no-op; None fields of ElementGeom change nothing, so the default theme (no ink/paper/accent set) stays byte-identical.
Source§

fn set_series_color(&mut self, color: (u8, u8, u8))

Apply a brand/primary color to this geom’s single-series default (its color or fill). The build pipeline calls this only when the layer has no color/fill aesthetic mapped, so an explicit mapping always wins. The default is a no-op; series geoms override it.
Source§

fn mapped_only_columns(&self) -> &'static [&'static str]

Canonical column names this geom only reads when the user actually mapped the corresponding aesthetic (D3, B3-5) — never from a raw column that merely happens to share the name (e.g. a SQL alias literally called lower). build_layer drops any of these columns right after resolve_mappings unless the aesthetic was mapped. Default empty; GeomBoxplot returns ["lower", "middle", "upper", "outliers"].
Source§

fn validate_layer( &self, pre_stat_columns: &[String], stat_name: &str, ) -> Result<(), String>

Stat-dependent layer validation beyond required_aes (B3-5): called once per layer with the resolved (pre-stat, post-D3-drop) column names and the layer’s stat name, before the stat runs. Default no-op. GeomBoxplot requires lower/middle/upper to be mapped under stat="identity", else y.
Source§

fn consumes_tooltips(&self) -> bool

Whether this geom calls [set_row_extras] (so it reads Aes::tooltip and Aes::data_attr, and a GGPlot::tooltip template on it has a visible effect). Default false; the build pipeline warns when a tooltip() template is set on a layer whose geom returns false here (review PR#141 finding 6, LOW: a template silently did nothing on e.g. geom_area/geom_boxplot/geom_ribbon). Point, segment, curve, path, line, hex, polygon, sf, rect/tile and col/bar/ histogram return true.
Source§

fn figure_band_height(&self, _width: f64, _theme: &Theme) -> Option<f64>

A figure-level layer on a faceted plot: the height of the band it needs under the whole panel grid at width, when it draws once there instead of in every panel (e.g. GeomAttribution::figure). Default None (drawn per panel).
Source§

fn include_zero_baseline(&self) -> bool

Whether this geom draws from a 0 baseline, so the Y scale should include 0 even when y is explicitly mapped (bars/columns/area/histograms — as in ggplot2). Default false.
Source§

fn allows_infinite(&self) -> bool

Whether -Inf/Inf position values are meaningful for this geom (ggplot2: “extend to the panel edge”). Rows with infinite positions are otherwise dropped with a warning before stats run. NaN is always dropped — unless Geom::keeps_na_as_break says otherwise. Default false; geom_rect returns true.
Source§

fn keeps_na_as_break(&self) -> bool

Whether a row with a non-finite position is a break rather than a removal (ggplot2’s GeomPath/GeomLine NA handling): the row still counts toward the “removed N rows” warning, but it is not deleted from the built DataFrame, so the geom’s own per-group point list still contains it — as a non-finite pixel position after the scale and coordinate transform, which crate::render::backend::DrawBackend::draw_line splits on into separate polylines (ggplot2’s NA-break semantics) instead of silently joining the finite points across the gap. Default false (the row is dropped, as for every other geom); line/path/step return true.
Source§

fn key_glyph(&self) -> Option<KeyGlyph>

The legend key this geom draws (ggplot2’s per-geom draw_key, #410). None = the plain per-aesthetic swatch (fill square, point shape, line type …), which is also what a key falls back to for a geom not listed here. Overridable per layer with GGPlot::key_glyph.
Source§

fn inherit_aes(&self) -> bool

Whether the layer inherits the plot-level aesthetic mapping (ggplot2’s inherit.aes). Reference-line geoms return false, as in ggplot2, so a plot-level color/x/y mapping does not leak into a geom_hline. Default true.

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V