我的输出有点混乱。我希望x轴上的状态可见
performance0 = denied_states['STATE'].value_counts().sort_index()
performance1 = certified_states['STATE'].value_counts().sort_index()
performance2 = cw_states['STATE'].value_counts().sort_index()
performance3 = w_states['STATE'].value_counts().sort_index()
plt.plot( performance0, label = 'Denied')
plt.plot( performance1, label = 'Certified')
plt.plot( performance2, label = 'Certified-Withdrawn')
plt.plot( performance3, label = 'Withdrawn')
plt.xticks(rotation=90)
plt.xlabel('States')
plt.ylabel('Applications')
plt.title('No. of Applicants status of H1B Visa based on states')
plt.legend()
plt.show()
输出:
答案 0 :(得分:0)
设置xticks
的语法是:
xticks(locs, [labels], **kwargs) # Set locations and label
**kwargs
可以包含Text properties,其中fontproperties
关键字可以为您分配FontProperties
对象。
因此您可以尝试以下操作:
fp = matplotlib.font_manager.FontProperties(family="sans-serif", size=8) # play around with the formatting
plt.xticks(rotation=90, fontproperties=fp)
另一种可能性是增加整个图的大小,具体说明如下:How do you change the size of figures drawn with matplotlib?