Draw histogram of the input series using matplotlib.
If passed, then used to form histograms for separate groups.
If not passed, uses gca().
Whether to show axis grid lines.
If specified changes the x-axis label size.
Rotation of x axis labels.
If specified changes the y-axis label size.
Rotation of y axis labels.
Figure size in inches by default.
Number of histogram bins to be used. If an integer is given, bins + 1 bin edges are calculated and returned. If bins is a sequence, gives bin edges, including left edge of first bin and right edge of last bin. In this case, bins is returned unmodified.
Backend to use instead of the backend specified in the option plotting.backend. For instance, ‘matplotlib’. Alternatively, to specify the plotting.backend for the whole session, set pd.options.plotting.backend.
Whether to show the legend.
To be passed to the actual plotting function.
A histogram plot.
See also
matplotlib.axes.Axes.histPlot a histogram using matplotlib.
Examples
For Series:
>>> lst = ['a', 'a', 'a', 'b', 'b', 'b']
>>> ser = pd.Series([1, 2, 2, 4, 6, 6], index=lst)
>>> hist = ser.hist()
For Groupby:
>>> lst = ['a', 'a', 'a', 'b', 'b', 'b']
>>> ser = pd.Series([1, 2, 2, 4, 6, 6], index=lst)
>>> hist = ser.groupby(level=0).hist()
© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.Series.hist.html