Skip to main content

ErrorBarOpts

Struct ErrorBarOpts 

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

Implementations§

Source§

impl ErrorBarOpts

Source

pub fn label(self, s: impl Into<String>) -> Self

Examples found in repository?
examples/errorbar.rs (line 14)
3fn main() {
4    let xs: Vec<f64> = (1..=8).map(|i| i as f64).collect();
5    let ys: Vec<f64> = xs.iter().map(|x| 2.0 * x.ln() + 1.0).collect();
6    let yerr: Vec<f64> = xs.iter().enumerate().map(|(i, _)| 0.2 + (i as f64 * 0.05)).collect();
7
8    let fig = Figure::new()
9        .size(PaperSize::A5Landscape)
10        .title("Mean ± 1σ")
11        .xlabel("trial")
12        .ylabel("response")
13        .errorbar(&xs, &ys, |e| {
14            e.yerr(&yerr).marker(Marker::CircleFilled).label("trials ±1σ")
15        })
16        .legend_bottom_right();
17
18    std::fs::create_dir_all("out").expect("create out/");
19    std::fs::write("out/errorbar.svg", fig.to_svg()).expect("write svg");
20    println!("wrote out/errorbar.svg");
21}
Source

pub fn yerr(self, e: &[f64]) -> Self

Symmetric y error: yerr[i] is the half-width above and below.

Examples found in repository?
examples/errorbar.rs (line 14)
3fn main() {
4    let xs: Vec<f64> = (1..=8).map(|i| i as f64).collect();
5    let ys: Vec<f64> = xs.iter().map(|x| 2.0 * x.ln() + 1.0).collect();
6    let yerr: Vec<f64> = xs.iter().enumerate().map(|(i, _)| 0.2 + (i as f64 * 0.05)).collect();
7
8    let fig = Figure::new()
9        .size(PaperSize::A5Landscape)
10        .title("Mean ± 1σ")
11        .xlabel("trial")
12        .ylabel("response")
13        .errorbar(&xs, &ys, |e| {
14            e.yerr(&yerr).marker(Marker::CircleFilled).label("trials ±1σ")
15        })
16        .legend_bottom_right();
17
18    std::fs::create_dir_all("out").expect("create out/");
19    std::fs::write("out/errorbar.svg", fig.to_svg()).expect("write svg");
20    println!("wrote out/errorbar.svg");
21}
Source

pub fn yerr_asym(self, e: &[(f64, f64)]) -> Self

Asymmetric y error: each entry is (lower, upper) half-widths.

Source

pub fn xerr(self, e: &[f64]) -> Self

Source

pub fn xerr_asym(self, e: &[(f64, f64)]) -> Self

Source

pub fn marker(self, m: Marker) -> Self

Examples found in repository?
examples/errorbar.rs (line 14)
3fn main() {
4    let xs: Vec<f64> = (1..=8).map(|i| i as f64).collect();
5    let ys: Vec<f64> = xs.iter().map(|x| 2.0 * x.ln() + 1.0).collect();
6    let yerr: Vec<f64> = xs.iter().enumerate().map(|(i, _)| 0.2 + (i as f64 * 0.05)).collect();
7
8    let fig = Figure::new()
9        .size(PaperSize::A5Landscape)
10        .title("Mean ± 1σ")
11        .xlabel("trial")
12        .ylabel("response")
13        .errorbar(&xs, &ys, |e| {
14            e.yerr(&yerr).marker(Marker::CircleFilled).label("trials ±1σ")
15        })
16        .legend_bottom_right();
17
18    std::fs::create_dir_all("out").expect("create out/");
19    std::fs::write("out/errorbar.svg", fig.to_svg()).expect("write svg");
20    println!("wrote out/errorbar.svg");
21}
Source

pub fn no_marker(self) -> Self

Source

pub fn marker_size(self, sz: f64) -> Self

Source

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

Source

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

Trait Implementations§

Source§

impl Debug for ErrorBarOpts

Source§

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

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

impl Default for ErrorBarOpts

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.