Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Description
Bug summary
The fontsize argument of ax.set_xticklabels() controls the size of azimuthal tick labels on a polar plot.
However the same argument, when passed to set_yticklabels(), does not control the size of radial tick labels. In fact it does nothing - the value of the argument has no impact on the plot.
To modify the size of radial tick labels, one must call: ax.yaxis.set_tick_params(labelsize='large')
This is not obvious.
Code for reproduction
importmatplotlib.pyplotaspltimportnumpyasnp# Make fake datad=np.random.rand(11,18)azimuths=np.radians(np.arange(-42.5,42.6,5))radials=np.linspace(1.3,3.9,11)r,theta=np.meshgrid(radials,azimuths)# Plot the datafig=plt.figure(figsize=(6,6))ax1=fig.add_subplot(111,polar=True)cont=ax1.contourf(theta,r,np.fliplr(d).T, )ax1.set_theta_zero_location('N')ax1.set_thetamin(-45)ax1.set_thetamax(45)ax1.set_xticks(np.arange(np.radians(-45),np.radians(46),np.radians(15), ))# Less radial ticksax1.set_xticklabels(np.arange(-45,46,15)[::-1],fontsize='xx-large',# This argument controls azimuthal tick labels )ax1.set_yticklabels(np.arange(-45,46,15)[::-1],fontsize='xx-large',# So why does this not control the radial tick labels? )# ax1.yaxis.set_tick_params(labelsize='xx-large') # Especially when this line *does* control themplt.show()
Actual outcome
Here you can see that the radial tick labels are too small, unaffected by the set_yticklabels command:
Expected outcome
They should be this size. The following is produced by using the set_tick_params command:
Additional information
No response
Operating system
Ubuntu 18.04
Matplotlib Version
This occurs with matplotlib v3.3.4
Matplotlib Backend
inline
Python version
3.7.10
Jupyter version
6.4.6
Installation
conda