Skip to main content

ErrorBarArtist

Struct ErrorBarArtist 

Source
pub struct ErrorBarArtist {
    pub x: Series,
    pub y: Series,
    pub xerr: Option<ErrorBarData>,
    pub yerr: Option<ErrorBarData>,
    pub color: Color,
    pub label: Option<String>,
    pub cap_size: f64,
    pub line_width: f64,
}
Expand description

An error bar plot showing data points with uncertainty bars.

Each data point (x, y) can have optional horizontal (xerr) and/or vertical (yerr) error bars. The error bars are drawn as lines with optional caps at the ends.

Fields§

§x: Series

X-coordinates of the data points.

§y: Series

Y-coordinates of the data points.

§xerr: Option<ErrorBarData>

Optional x-axis error data.

§yerr: Option<ErrorBarData>

Optional y-axis error data.

§color: Color

Color for the center line, error bars, and caps.

§label: Option<String>

Optional legend label.

§cap_size: f64

Cap size in pixels for the error bar ends.

§line_width: f64

Stroke width of the error bar lines and caps.

Implementations§

Source§

impl ErrorBarArtist

Source

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

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

Includes the extent of error bars when present, so that auto-scaling shows the full error range.

Source§

impl ErrorBarArtist

Source

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

Sets the color for the center line, error bars, and caps.

Accepts any Color value, which can be constructed from RGB components, hex strings, or named color constants.

§Examples
artist.color(Color::TAB_RED);
Source

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

Sets the legend label for this error bar plot.

When a label is set, the error bar plot will appear in the legend if one is displayed on the axes. Pass an empty string or omit this call to exclude the plot from the legend.

§Examples
artist.label("Measurements");
Source

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

Sets the cap size in pixels for the error bar ends.

Caps are the small horizontal (or vertical) lines drawn at the tips of the error bars. A value of 0.0 disables caps entirely. The default is 4.0 pixels.

§Examples
artist.cap_size(6.0);
Source

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

Sets the stroke width of the error bar lines and caps.

Also affects the center connecting line. A width of 1.0 is the default hairline width.

§Examples
artist.line_width(2.0);
Source

pub fn yerr_symmetric(self, errs: &[f64]) -> Self

Sets symmetric y-error values.

Each error value e produces an error bar from y - e to y + e at the corresponding data point. The length of errs must equal the number of data points.

§Examples
artist.yerr_symmetric(&vec![0.5, 0.3, 0.4]);
Source

pub fn yerr_asymmetric(self, low: &[f64], high: &[f64]) -> Self

Sets asymmetric y-error values.

Each point gets a separate low and high error. The error bar spans from y - low[i] to y + high[i]. Both slices must have the same length as the data series.

§Examples
artist.yerr_asymmetric(&low_errs, &high_errs);
Source

pub fn xerr_symmetric(self, errs: &[f64]) -> Self

Sets symmetric x-error values.

Each error value e produces a horizontal error bar from x - e to x + e at the corresponding data point. The length of errs must equal the number of data points.

§Examples
artist.xerr_symmetric(&vec![0.2, 0.1, 0.15]);
Source

pub fn xerr_asymmetric(self, low: &[f64], high: &[f64]) -> Self

Sets asymmetric x-error values.

Each point gets a separate low and high horizontal error. The error bar spans from x - low[i] to x + high[i]. Both slices must have the same length as the data series.

§Examples
artist.xerr_asymmetric(&low_errs, &high_errs);

Trait Implementations§

Source§

impl Clone for ErrorBarArtist

Source§

fn clone(&self) -> ErrorBarArtist

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 ErrorBarArtist

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.