Good Day,
See the attached image for reference. The x-axis on the Seaborn bar chart I created has overlapping text and is too crowded. How do I fix this?
The data source is on Kaggle and I was following along with this article: https://towardsdatascience.com/a-quick-guide-on-descriptive-statistics-using-pandas-and-seaborn-2aadc7395f32
Here is the code I used:
sns.set(style = 'darkgrid')
plt.figure(figsize = (20, 10))
ax = sns.countplot(x = 'Regionname', data = df)
I'd appreciate any help.
Thanks!
You are not using the figure size you set on the previous line. Try
fig, ax = plt.subplots(figsize=(20, 10)) # generate a figure and return figure and axis handle
sns.countplot(x="Regionname", data=df, ax=ax) # passing the `ax` to seaborn so it knows about it
An extra thing after this might be to rotate the labels:
ax.set_xticklabels(ax.get_xticklabels(), rotation=60)