Style Customization

When plotting, ezel uses a lot of aesthetic parameters.

Even rendering a simple scatter plot requires

  • marker size

  • marker shape

  • marker color

  • background color

  • x axis label size

  • x axis label text

  • x axis label color

  • ..

For a minimal API, they are all optional and structured into MarkerOpts, AxisOpts, etc.

struct Cartesian2 {
    marker_opts: Option<MarkerOpts>,
}

let mut plot = ezel::Cartesian2::new();
plot.style.marker = MarkerOpts::default();
plot.style.marker.size = Some(10.0);

When unspecified, the value is provided by the theme.

Theme

A theme is a collection of default style configurations.

You can create a new theme or use one of built-in themes.

let mut theme: Theme = ezel::theme::MATPLOTLIB.clone();
theme.marker.size = Some(12.0);  // customize the matplotlib theme

[screenshot of themes]

Last updated