[英]Pandas Bar Graph Axis
I'm making the graph linked below and I need to change the x-axis which belongs to the order of the data to the CCAA or city.我正在制作下面链接的图表,我需要将属于数据顺序的 x 轴更改为 CCAA 或城市。 How would I do this?
我该怎么做? Thanks!
谢谢!
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
Specify the xticks
指定
xticks
data2[['Cases','Deaths','Recovered']].plot(
kind='bar', figsize=(10, 10),
legend=True, fontsize=13,
xticks=data2.CCAA)
Convert column CCAA
to index before plot:将列
CCAA
转换为 plot 之前的索引:
(data2.set_index('CCAA')[['Cases','Deaths','Recovered']]
.plot(kind='bar',
figsize=(10, 10),
legend=True,
fontsize=13))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.