i have the following code :
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()
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?
To make longer subplot tick marks in matplotlib, we can use tick_params() method for minor and major ticks length and width.
Changing Font Sizes in Matplotlib Using FontsizeEvery Matplotlib function that deals with fonts, such as the ones we used above, has a parameter named fontsize= to control the font size. This means when we set, say, a title using the . set_title() function, we can pass in an argument to specify the font size.
The xticks() and yticks() function takes a list object as argument. The elements in the list denote the positions on corresponding action where ticks will be displayed. This method will mark the data points at the given positions with ticks.
Try to use tick_params
function like here:
ax = plt.gca()
ax.tick_params(axis = 'both', which = 'major', labelsize = 24)
ax.tick_params(axis = 'both', which = 'minor', labelsize = 16)
You may specify axis like 'x' or 'y' instead of 'both'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With