调整熊猫条形图的标签;

时间:2021-04-17 18:36:30

标签: python pandas graph charts label

出于好奇,您如何根据 PD 标签调整图形标签?enter image description here

#Create bar charts to show outliers:
fig, ax = plt.subplots()
a1['Word #'].value_counts().plot(ax=ax, kind='bar', x='Word #', y='Frequency')

我尝试给它贴上不同的标签,但我认为它不起作用。感谢您的所有帮助!

1 个答案:

答案 0 :(得分:0)

您是否尝试过 xlabel()ylabel()

#Create bar charts to show outliers:
fig, ax = plt.subplots()
a1['Word #'].value_counts().plot(ax=ax, kind='bar', x='Word #', y='Frequency')

plt.xlabel("Label what you want")
plt.ylabel("Label what you want")
plt.show()

ax.set_xlabel('xlabel')
ax.set_ylabel('ylabel')
plt.show()

这对于您的示例也可能更好:

lt.xticks(rotation=90)