python matplotlib绘图缩放X轴和标签
我的输出有点乱。我希望x轴上的状态是可见的python matplotlib绘图缩放X轴和标签,python,matplotlib,Python,Matplotlib,我的输出有点乱。我希望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
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()
输出:
**kwargs
可能包含其中的fontproperties
关键字,您可以将对象分配给该关键字
因此,您可以尝试以下方法:
fp = matplotlib.font_manager.FontProperties(family="sans-serif", size=8) # play around with the formatting
plt.xticks(rotation=90, fontproperties=fp)
fp = matplotlib.font_manager.FontProperties(family="sans-serif", size=8) # play around with the formatting
plt.xticks(rotation=90, fontproperties=fp)