美好的一天,
请参阅所附图片以供参考。我创建的 Seaborn 条形图上的 x 轴有重叠的文本并且太拥挤了。我该如何解决这个问题?
数据源在 Kaggle 上,我一直在关注这篇文章:https://towardsdatascience.com/a-quick-guide-on-descriptive-statistics-using-pandas-and-seaborn-2aadc7395f32
这是我使用的代码:
hospital = Hospital.objects.first()
Appointment.objects.filter(treament__hispital=hospital)
感谢您的帮助。
谢谢!
答案 0 :(得分:0)
您没有使用您在上一行中设置的图形大小。试试
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
此后的一个额外的事情可能是旋转标签:
ax.set_xticklabels(ax.get_xticklabels(), rotation=60)