Skip to main content

Module histogram

Module histogram 

Source
Expand description

Histogram chart builder methods and binning utilities.

This module extends HistArtist with a fluent API for configuring histogram properties, and provides the compute_bins utility function for computing equal-width bin edges and counts from raw data.

Since Axes::hist returns Result<&mut HistArtist>, the builder methods can be chained directly on the return value:

ax.hist(&data, 20)?
    .color(Color::TAB_BLUE)
    .label("Distribution")
    .alpha(0.7)
    .density(true);

The compute_bins function is typically called internally when constructing a HistArtist, but it is public so that users can pre-compute bin edges and counts for custom workflows.

Functions§

compute_bins
Computes equal-width bin edges and counts for a histogram.