graphinglib.Histogram#
- class graphinglib.Histogram(data: ArrayLike, bins: int, label: str | None = None, face_color: str | Inherit = Inherit, edge_color: str | Inherit = Inherit, hist_type: str | Inherit = Inherit, alpha: float | Inherit = Inherit, line_width: float | Inherit = Inherit, normalize: bool | Inherit = Inherit, orientation: str | Inherit = Inherit, show_params: bool | Inherit = Inherit)[source]#
This class implements a general histogram.
- Parameters:
- dataArrayLike
Array of values to be plotted.
- binsint | ArrayLike
If bins is an integer, it defines the number of equal_width bins to be used in the histogram. If bins is an array, it defines the bin edges to be used in the histogram, including the left edge of the first bin and the right edge of the last bin.
- labelstr, optional
Label to be displayed in the legend.
- face_colorstr
Face color of the histogram. Default depends on the
figure_styleconfiguration.- edge_colorstr
Edge color of the histogram. Default depends on the
figure_styleconfiguration.- hist_typestr
Type of the histogram. Values are
"bar","barstacked","step", and"stepfilled". Default depends on thefigure_styleconfiguration.- alphafloat
Opacity of the histogram. Range is
0(transparent) to1(opaque). Default depends on thefigure_styleconfiguration.- line_widthfloat
Width of the histogram edge. Typical range is
0.5to3points. Default depends on thefigure_styleconfiguration.- normalizebool
Whether or not to normalize the histogram. Default depends on the
figure_styleconfiguration.- orientation: str
Whether to plot the histogram on x-axis or on y-axis. Values are
"vertical"and"horizontal". Default depends on thefigure_styleconfiguration.- show_paramsbool
Whether or not to show the mean and standard deviation of the data. Default depends on the
figure_styleconfiguration.
Notes
Color parameters accept Matplotlib color formats: named colors (
"blue"), short color strings ("b"), hex strings ("#0000ff"), grayscale strings ("0.5"), and RGB/RGBA tuples with values between0and1((0, 0, 1)or(0, 0, 1, 0.5)).Methods
__init__(data, bins[, label, face_color, ...])This class implements a general histogram.
add_pdf([type, show_mean, show_std, ...])Shows the probability density function of the histogram.
copy()Returns a deep copy of the
Histogramobject.copy_with(**kwargs)Returns a deep copy of the Plottable with specified attributes overridden.
from_fit_residuals(fit, bins[, label, ...])Calculates the residuals of a fit and plots them as a histogram.
to_desmos([decimal_precision, to_clipboard])Gives every bin's upper center in a Desmos-readable format.