我正在建立下面的链接图,我需要将属于数据顺序的x轴更改为CCAA或城市。我该怎么做?谢谢!
data = data.sort_values(by=['Cases'], ascending=False)
Combined = data2[['Cases','Deaths','Recovered']].plot(kind='bar',[enter image description here][1] figsize=(10, 10), legend=True, fontsize=13 )
plt.show
答案 0 :(得分:0)
指定xticks
data2[['Cases','Deaths','Recovered']].plot(
kind='bar', figsize=(10, 10),
legend=True, fontsize=13,
xticks=data2.CCAA)
答案 1 :(得分:0)
在绘制前将列CCAA
转换为索引:
(data2.set_index('CCAA')[['Cases','Deaths','Recovered']]
.plot(kind='bar',
figsize=(10, 10),
legend=True,
fontsize=13))