pub struct ErrorBarOpts { /* private fields */ }Implementations§
Source§impl ErrorBarOpts
impl ErrorBarOpts
Sourcepub fn label(self, s: impl Into<String>) -> Self
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}Sourcepub fn yerr(self, e: &[f64]) -> Self
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}Sourcepub fn yerr_asym(self, e: &[(f64, f64)]) -> Self
pub fn yerr_asym(self, e: &[(f64, f64)]) -> Self
Asymmetric y error: each entry is (lower, upper) half-widths.
pub fn xerr(self, e: &[f64]) -> Self
pub fn xerr_asym(self, e: &[(f64, f64)]) -> Self
Sourcepub fn marker(self, m: Marker) -> Self
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}pub fn no_marker(self) -> Self
pub fn marker_size(self, sz: f64) -> Self
pub fn cap_width(self, w: f64) -> Self
pub fn stroke_width(self, w: f64) -> Self
Trait Implementations§
Source§impl Debug for ErrorBarOpts
impl Debug for ErrorBarOpts
Auto Trait Implementations§
impl Freeze for ErrorBarOpts
impl RefUnwindSafe for ErrorBarOpts
impl Send for ErrorBarOpts
impl Sync for ErrorBarOpts
impl Unpin for ErrorBarOpts
impl UnsafeUnpin for ErrorBarOpts
impl UnwindSafe for ErrorBarOpts
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more