I want to plot a histogram of my DataFrame using pandas.DataFrame.hist
, but I don't want to show the y-axis tick labels.
I have tried this solution and this solution, but it still doesn't work for pandas.DataFrame.hist
So far the code looks like this
import pandas as pd
import matplotlib.pyplot as plt
df = pd.DataFrame({
'length': [1.5, 0.5, 1.2, 0.9, 3],
'width': [0.7, 0.2, 0.15, 0.2, 1.1]
}, index=['pig', 'rabbit', 'duck', 'chicken', 'horse'])
fig, ax = plt.subplots()
ax.axes.get_yaxis().set_visible(False)
hist = df.hist(bins=3, ax=ax)
And the histogram looks like this:
But I want it to look like this (edited on mspaint):