Closed
Description
The combination of histtype='stepfilled'
and normed=True
seem to cause some problems with the max ylimit.
import matplotlib.pyplot as plt
import seaborn.apionly as sns
iris = sns.load_dataset('iris')
plt.figure()
for species, species_df in iris.groupby("species"):
plt.hist(species_df["petal_length"].values, normed=True, histtype="stepfilled")
plt.legend(sorted(iris.species.unique()))
Which is not the case when only using histtype='stepfilled'
.
plt.figure()
for species, species_df in iris.groupby("species"):
plt.hist(species_df["petal_length"].values, histtype="stepfilled")
Or when only using normed=True
.
plt.figure()
for species, species_df in iris.groupby("species"):
plt.hist(species_df["petal_length"].values, normed=True)
It seems like in the erroneous case above, the max of the yaxis is set by the last plotted distribution, which can be tested by changing the order of when the different histograms are plotted.
plt.figure()
iris.loc[iris.species == 'setosa', 'species'] = 'wsetosa'
for species, species_df in iris.groupby("species"):
plt.hist(species_df["petal_length"].values, normed=True, histtype="stepfilled")
plt.legend(sorted(iris.species.unique()))