Skip to content

ENH: Histogram axis labels #53281

Closed
Closed
@sorenwacker

Description

@sorenwacker

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

How about improving the labels on the generated histograms?


df = pd.DataFrame(dict(a=np.random.normal(size=100), b=np.random.normal(size=100)+100, c=np.random.choice(['A', 'B'], size=100)))
df

image

image

Using the series object, the figure has no labels at all.

df[['a']].hist()

image
When using the a dataframe objet, the subplots titles are the variable names.

Actually, the x-axis correspond to the values of variable a, instead of the title the name of the axis shoud be the x-axis label.
Since we have a histogram, the y-axes should be labeled with 'Counts'.

And using by= should add a legend to know which color is for what label.

df.hist(by='c')
image

This plot also should look more like this:

image

The labels do not make sense anymore since value from A and B

Feature Description

Instead of using title(column-name) use xlabel(column-name). Set 'Count' as y-label by default.

Alternative Solutions

Allow seaborn as backend?

Additional Context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions