Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pandas/plotting/_matplotlib/hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,26 @@ def hist_series(
ax = fig.gca()
elif ax.get_figure() != fig:
raise AssertionError("passed axis not bound to passed figure")

## inferring xlabel from the Series
if hasattr(self,'name'):
xlabel=self.name
else:
xlabel=None

values = self.dropna().values
if legend:
kwds["label"] = self.name
ax.hist(values, bins=bins, **kwds)
if legend:
ax.legend()
ax.grid(grid)

## setting xlabel
ax.set(
xlabel=xlabel
)

axes = np.array([ax])

set_ticks_props(
Expand Down
Loading