Canvas

Struct Canvas 

Source
pub struct Canvas { /* private fields */ }
Expand description

Where to plot

Implementations§

Source§

impl Canvas

Source

pub fn new() -> Self

Examples found in repository?
examples/csv.rs (line 7)
4fn main() {
5    let dataset =
6        DataSet::from_csv(fs::read_to_string("examples/sample.csv").unwrap().as_str()).unwrap();
7    let mut canvas = Canvas::new();
8    let _ = dataset.draw_into(&mut canvas, PlotKind::default());
9    println!("{canvas}");
10}
More examples
Hide additional examples
examples/axes0.rs (line 6)
3fn main() {
4    let mut dataset = DataSet::default();
5    dataset.add_points("1".into(), vec![(1.0, 1.0), (4.0, 4.0), (3.3, 2.5)]);
6    let mut canvas = Canvas::new();
7    let _ = dataset.draw_into(&mut canvas, PlotKind::Point);
8    println!("{canvas}");
9}
examples/axes1.rs (line 6)
3fn main() {
4    let mut dataset = DataSet::default();
5    dataset.add_points("1".into(), vec![(1.0, -1.0), (4.0, -4.0), (3.3, -2.5)]);
6    let mut canvas = Canvas::new();
7    let _ = dataset.draw_into(&mut canvas, PlotKind::Point);
8    println!("{canvas}");
9}
examples/axes3.rs (line 6)
3fn main() {
4    let mut dataset = DataSet::default();
5    dataset.add_points("1".into(), vec![(-1.0, 1.0), (-4.0, 4.0), (-3.3, 2.5)]);
6    let mut canvas = Canvas::new();
7    let _ = dataset.draw_into(&mut canvas, PlotKind::Point);
8    println!("{canvas}");
9}
examples/axes2.rs (line 6)
3fn main() {
4    let mut dataset = DataSet::default();
5    dataset.add_points("1".into(), vec![(-1.0, -1.0), (-4.0, -4.0), (-3.3, -2.5)]);
6    let mut canvas = Canvas::new();
7    let _ = dataset.draw_into(&mut canvas, PlotKind::Point);
8    println!("{canvas}");
9}
examples/multikind.rs (line 7)
4fn main() {
5    let dataset =
6        DataSet::from_csv(fs::read_to_string("examples/sample.csv").unwrap().as_str()).unwrap();
7    let mut canvas = Canvas::new();
8    let _ = dataset.draw_into(&mut canvas, PlotKind::Point);
9    println!("{canvas}");
10    canvas.clear();
11    let _ = dataset.draw_into(&mut canvas, PlotKind::Boxplot);
12    println!("{canvas}");
13    canvas.clear();
14    let _ = dataset.draw_into(&mut canvas, PlotKind::CDF);
15    println!("{canvas}");
16    canvas.clear();
17    let _ = dataset.draw_into(&mut canvas, PlotKind::Histogram);
18    println!("{canvas}");
19}
Source

pub fn clear(&mut self)

Remove drawing

Examples found in repository?
examples/multikind.rs (line 10)
4fn main() {
5    let dataset =
6        DataSet::from_csv(fs::read_to_string("examples/sample.csv").unwrap().as_str()).unwrap();
7    let mut canvas = Canvas::new();
8    let _ = dataset.draw_into(&mut canvas, PlotKind::Point);
9    println!("{canvas}");
10    canvas.clear();
11    let _ = dataset.draw_into(&mut canvas, PlotKind::Boxplot);
12    println!("{canvas}");
13    canvas.clear();
14    let _ = dataset.draw_into(&mut canvas, PlotKind::CDF);
15    println!("{canvas}");
16    canvas.clear();
17    let _ = dataset.draw_into(&mut canvas, PlotKind::Histogram);
18    println!("{canvas}");
19}

Trait Implementations§

Source§

impl Debug for Canvas

Source§

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

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

impl Default for Canvas

Source§

fn default() -> Canvas

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

impl Display for Canvas

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Canvas

§

impl RefUnwindSafe for Canvas

§

impl Send for Canvas

§

impl Sync for Canvas

§

impl Unpin for Canvas

§

impl UnwindSafe for Canvas

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.