如何在matplotlib图中更改xticks字体大小
问题描述:
我有以下代码:
ax=df_pivoted.plot(figsize=(30,15),linewidth=5)
plt.xticks( rotation=45)
plt.tick_params(labelsize = 20)
plt.xlabel('transaction_date', fontsize=20)
plt.grid(True)
plt.title('daily sale graph test_id=505 ',fontdict={'fontsize':30})
legend = ax.legend(loc=0, ncol=1, bbox_to_anchor=(0, 0, 1,1),fancybox=True,shadow=False,title='variations',prop={'size':30})
plt.setp(legend.get_title(),fontsize='30')
xposition = c12_days
for xc in xposition:
ax.axvline(x=xc, color='g', linestyle='--')
plt.show()
上面的代码产生以下图形,其中我在x轴上有日期,但问题是,正如您所见,日的大小很小,但JUL和AUG较大,我为xticks和tick_params尝试了不同的字体大小,但没有看到任何重大变化.我如何更改代码以使日数与7月和8月一样大?
above code produce following graph where i have dates in x axis but the problem is that as you can see days have very small size but JUL and AUG are bigger i have tried different font sizes for xticks and tick_params but have not seen any major change. how can i change the code to have day numbers as big as JUL and AUG?