Struct poloto::Plotter[][src]

pub struct Plotter<'a, T> { /* fields omitted */ }

Keeps track of plots. User supplies iterators that will be iterated on when render is called.

Implementations

impl<'a, T: Write + 'a> Plotter<'a, T>[src]

pub fn new(writer: T) -> Plotter<'a, T>[src]

Create a plotter

Example

let mut s=String::new();
let plotter = poloto::Plotter::new(&mut s);

pub fn line(
    &mut self,
    name: impl FnOnce(&mut T) -> Result + 'a,
    plots: impl DoubleIter<Item = [f64; 2]> + 'a
)
[src]

Create a line from plots.

Example

let data=[
        [1.0f64,4.0],
        [2.0,5.0],
        [3.0,6.0]
];
use poloto::prelude::*;
let mut s=String::new();
let mut plotter = poloto::Plotter::new(&mut s);
plotter.line(|w|write!(w,"cow"),data.iter().map(|&x|x).twice_iter())

pub fn line_fill(
    &mut self,
    name: impl FnOnce(&mut T) -> Result + 'a,
    plots: impl DoubleIter<Item = [f64; 2]> + 'a
)
[src]

Create a line from plots that will be filled underneath.

Example

let data=[
        [1.0f64,4.0],
        [2.0,5.0],
        [3.0,6.0]
];
use poloto::prelude::*;
let mut s=String::new();
let mut plotter = poloto::Plotter::new(&mut s);
plotter.line_fill(|w|write!(w,"cow"),data.iter().map(|&x|x).twice_iter())

pub fn scatter(
    &mut self,
    name: impl FnOnce(&mut T) -> Result + 'a,
    plots: impl DoubleIter<Item = [f64; 2]> + 'a
)
[src]

Create a scatter plot from plots.

Example

let data=[
        [1.0f64,4.0],
        [2.0,5.0],
        [3.0,6.0]
];
use poloto::prelude::*;
let mut s=String::new();
let mut plotter = poloto::Plotter::new(&mut s);
plotter.scatter(|w|write!(w,"cow"),data.iter().map(|&x|x).twice_iter())

pub fn histogram(
    &mut self,
    name: impl FnOnce(&mut T) -> Result + 'a,
    plots: impl DoubleIter<Item = [f64; 2]> + 'a
)
[src]

Create a histogram from plots. Each bar’s left side will line up with a point

Example

let data=[
        [1.0f64,4.0],
        [2.0,5.0],
        [3.0,6.0]
];
use poloto::prelude::*;
let mut s=String::new();
let mut plotter = poloto::Plotter::new(&mut s);
plotter.histogram(|w|write!(w,"cow"),data.iter().map(|&x|x).twice_iter())

pub fn render_no_default_tags(
    self,
    title: impl FnOnce(&mut T) -> Result,
    xname: impl FnOnce(&mut T) -> Result,
    yname: impl FnOnce(&mut T) -> Result
) -> Result<T, Error>
[src]

You can override the css in regular html if you embed the generated svg. This gives you a lot of flexibility giving your the power to dynamically change the theme of your svg.

However, if you want to embed the svg as an image, you lose this ability. If embedding as IMG is desired, instead the user can insert a custom style into the generated svg itself.

All the plot functions don’t actually add anything to the document until a render function is called. So calls to this will append elements to the start of the document.

pub fn render(
    self,
    title: impl FnOnce(&mut T) -> Result,
    xname: impl FnOnce(&mut T) -> Result,
    yname: impl FnOnce(&mut T) -> Result
) -> Result<T, Error>
[src]

Auto Trait Implementations

impl<'a, T> !RefUnwindSafe for Plotter<'a, T>

impl<'a, T> !Send for Plotter<'a, T>

impl<'a, T> !Sync for Plotter<'a, T>

impl<'a, T> Unpin for Plotter<'a, T> where
    T: Unpin

impl<'a, T> !UnwindSafe for Plotter<'a, T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.