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 using functions in
buildmodule - Compute min/max by calling
collect(). - Link the data with canvas options by calling
Data::stage_with()or use default canvas withData::stage() - Create tick distributions. (This step can be done automatically using
Stager::plot()) - Collect title/xname/yname using
Stager::plot()orStager::plot_with() - Write everything to svg.
Plotter::render()for 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 TickFormatExt::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 ticks::from_iter 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 step example
Modules
Tools for assembling plots
Some impls of PlotNum and TickFormat.
The poloto prelude.
Tools to render plots
A simple dark and light css theme.
Tools to create tick distributions.
Misc functions.
Macros
Shorthand for disp_const(move |w|write!(w,...))
Similar to std::format_args!() except has a more flexible lifetime.
Functions
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::BaseFmt
Update a std::io::Write to be a std::fmt::Write