Question

In the following example, I have 7 x-axis labels. The 1st label is '60m' and the remaining are 1/12th degree ... 1/2 degree. However in the resulting figure the size of 60m is appropriate (16), but the others are much smaller. How do I fix it?

xtck = ['60m',r'$\frac{1}{12} ^\circ$',r'$\frac{1}{6} ^\circ$',r'$\frac{1}{4} ^\circ$',\
        r'$\frac{1}{3} ^\circ$',r'$\frac{5}{12} ^\circ$',r'$\frac{1}{2} ^\circ$']
xtickNames = pyplot.setp(ax1, xticklabels=xtck)
pyplot.setp(xtickNames, fontsize=16)

enter image description here

Was it helpful?

Solution

This is because all you other ticks are mathtext except the first one, the easiest fix is to use mathtext for the first one as well, such as:

xtck = ['$60m$'.......

Now they will be of the same style.

'60m' should appear somewhat larger in the end, as the others are fractions.

If you are trying to force the 60m to appear as the same size as the others, change it manually by adding this line in the end:

ax1.xaxis.get_ticklabels()[0].set_fontsize(10) #10/16 is almost the Golden ratio
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top