Expand description
A plotting library with a focus on publication level aesthetics and ergonomic control.
§Structure
- Plots are drawn on a
Subplot
. - One or more subplots are organized in a
Layout
. - The layout is added to a
Figure
, which is used to draw to a file or directly to abackend::Canvas
.
§Use
To get started, see the examples directory in the main repository.
§Example
// create data
let xs: Vec<f64> = (0..=100).map(|n: u32| n as f64 * 0.1).collect();
let ys: Vec<f64> = xs.iter().map(|x| x.powi(3)).collect();
// create subplot
let mut sp = Subplot::builder()
.label(Axes::X, "x data")
.label(Axes::Y, "y data")
.build();
// plot data
sp.plot(&xs, &ys).unwrap();
// make figure and add subplot
let mut fig = <Figure>::default();
fig.set_layout(SingleLayout::new(sp)).unwrap();
// save figure to file
fig.draw_file(FileFormat::Png, "example.png").unwrap();
§Dependencies
Currently, the only implemented backend depends on Cairo.
§Debian / Ubuntu
apt install libcairo2-dev
§Arch
pacman -Syu cairo
Modules§
- backend
- Re-exports of neccessary plt-draw backend elements.
Structs§
- Color
- An RGBA float representation of a color.
- FigSize
- The size of a figure, in inches.
- Figure
- Represents a whole figure, containing subplots, which can be drawn as an image.
- Figure
Format - Describes the configuration of a
Figure
. - Filler
- Fills a region of a subplot with a color.
- Fractional
Area - Defines an area of a figure in terms of fractional boundaries.
- Grid
Layout - A
Layout
in which subplots are placed in a grid orientation in the figure. - Plotter
- Plots data on a subplot using the builder pattern.
- Single
Layout - A
Layout
in which a single subplot fills the whole figure. - Subplot
- The object that represents a whole subplot and is used to draw plotted data.
- Subplot
Builder - Builds and sets the configuration for a
Subplot
. - Subplot
Format - The formatting for a subplot.
Enums§
- Axes
- Identifies one or more plot axes.
- File
Format - A graphics image file format.
- Font
Name - The name of a text font.
- Grid
- Indicates which, if any, tick marks on an axis should have grid lines.
- Limits
- How the maximum and minimum plotted values of an axis should be set.
- Line
Style - Plotting line styles.
- Marker
Style - Marker shapes.
- PltError
- The error type for this library.
- Tick
Direction - Indicates which side of the axes ticks should point towards.
- Tick
Labels - Describes how and whether tick mark labels are set.
- Tick
Spacing - Describes how tick mark locations are determined, if at all.