Expand description
Plot to SVG and style with CSS
You can find poloto on github and crates.io. Documentation at docs.rs
Check out the github examples. The latest graph outputs of the examples can be found in the assets folder.
Pipeline:
- Collect plots (
datafunction) - Compute min/max (call
Data::buildand generate aDataResult). - Create tick distributions. (This step can be done automatically using
DataResult::plotinstead ofDataResult::plot_with) - Collect title/xname/yname (on creation of
Plotter) - Write everything to svg.
Plotter::renderfor no svg tag/css.simple_theme::SimpleThemefor basic css/svg tag.
Poloto provides by default 3 impls of HasDefaultTicks for the following types:
i128- decimal/scientific notation ticks.f64- decimal/scientific notation ticks.UnixTime- date/time
The above types have the advantage of automatically selecting reasonable
tick intervals. The user can change the formatting of the ticks while still using
the ticks that were selected via its automatic methods using TickFormat::with_tick_fmt.
However, sometimes you may want more control on the ticks, or want to use a type
other than i128/f64/UnixTime. One way would be to write your own function that returns a TickInfo.
Alternatively you can use the steps function that just takes an iterator of ticks and returns a TickInfo.
This puts more responsibility on the user to pass a decent number of ticks. This should only really be used when the user
knows up front the min and max values of that axis. This is typically the case for
at least one of the axis, typically the x axis. See marathon example
Modules
Create a PlotIter from a plot with min/max bounds known beforehand.
Create a PlotIter from an iterator that does not implement Clone.
Some impls of PlotNum and TickFormat.
The poloto prelude.
A simple dark and light css theme.
Misc functions.
Macros
Shorthand for disp_const(move |w|write!(w,...))
Similar to std::format_args!() except has a more flexible lifetime.
Structs
Created once the min and max bounds of all the plots has been computed.
Contains in it all the information typically needed to make a TickInfo.
Plot collector.
Created by Data::build
Created by DataResult::plot or DataResult::plot_with
Functions
Start plotting.
Leverage rust’s display format system using std::cell::RefCell under the hood.
Convert a closure to a object that implements Display
Leverage rust’s display format system using std::cell::RefCell under the hood.
Create a plot formatter that implements plotnum::PlotFmt
Create a plotnum::TickInfo from a step iterator.
Create a tick distribution from the default tick generator for the plotnum type.
Update a std::io::Write to be a std::fmt::Write