Statistics
Histograms, KDE and ECDF
Overlapping density histograms with a KDE line; cumulative step histogram and ECDF.
Code of this example · cargo run --release -p plot-histograms
Box and violin plots
Notched box plots with means and outliers next to violin plots.
Code of this example · cargo run --release -p plot-box-violin
Distributions
Strip plot (jittered points), swarm plot (points side by side without overlap), a ridgeline of monthly temperatures (densities on overlapping rows) and a Q-Q plot that shows incomes are not normally distributed.
#![allow(unused)]
fn main() {
ax.strip([("Mon", &mon), ("Tue", &tue)]);
ax.swarm([("Mon", &mon), ("Tue", &tue)]);
ax.ridgeline(months); // (name, values) per row
ax.qq(&incomes); // against the normal distribution
}
Code of this example · cargo run --release -p plot-distributions
Facets and pair plots
Figure::facet_wrap draws one plot per group in a grid with shared ranges
(tick labels on the outer plots only, all plots the same size);
Figure::pair_plot draws the scatter matrix of several variables with
histograms on the diagonal.
#![allow(unused)]
fn main() {
fig.facet_wrap(cities, 3, |ax, data| { ax.line(&months, data); });
fig.pair_plot([("length", &length), ("weight", &weight), ("phase", &phase)]);
}
Code of this example · cargo run --release -p plot-facets
2D histogram and hexbin
Density of 20 000 points as a 2D histogram and as hexagonal bins.
Code of this example · cargo run --release -p plot-hist2d-hexbin