histogram

Signature

histogram(
    x: ArrayLike,
    *,
    ddof: int | float = 0,
    style: str | None = "mespy",
    bins: int | str | ArrayLike = "auto",
    bin_width: float | None = None,
    hist_range: ArrayLike | None = None,
    label: str = "Dati",
    xlabel: str = "Valore",
    ylabel: str | None = None,
    title: str = "Istogramma",
    show_bin_ticks: bool = True,
    tick_rotation: int | float = 0,
    decimals: int = 3,
    show_mean: bool = True,
    show_band: bool = True,
    show_legend: bool = True,
    show_grid: bool = True,
    xlim: ArrayLike | None = None,
    ylim: ArrayLike | None = None,
    ax: Axes | None = None,
    figsize: ArrayLike | None = None,
    dpi: int | None = None,
    save_path: str | None = None,
    title_fontsize: int | float | None = None,
    title_pad: int | float | None = None,
    legend_fontsize: int | float | None = None,
    legend_loc: str | None = None,
    bar_color: str | None = None,
    mean_color: str = "#D65F5F",
    band_color: str = "#EE854A",
    edgecolor: str | None = None,
    hist_alpha: float = 0.85,
    band_alpha: float = 0.15,
    grid_alpha: float | None = None,
    mean_symbol: str = r"\bar{x}",
) -> tuple[Figure, Axes]

histogram draws a histogram for a numeric sample and can add the mean, a +- 1 sigma band, legend, grid, and figure saving. By default it applies the mespy Matplotlib style; pass style=None to use the current rcParams, or the name of another style to delegate to Matplotlib.

The figsize, dpi, title_fontsize, title_pad, legend_fontsize, legend_loc, bar_color, edgecolor, and grid_alpha parameters can inherit from the active style when left as None. The mean_color, band_color, hist_alpha, band_alpha, and mean_symbol parameters remain explicit per-call overrides instead.

This page remains the quick entry point. Full details are in Overview, while How it works is set up as a dedicated subpage.