I would like to adjust the position of my matplotlib yticklabels, so that the center of my yticklabel text will be aligned with ytick.
those. in the following figure
fig,ax=plt.subplots(1)
ax.plot(n.linspace(0,5,80),1+(n.linspace(0,5,80)/6.),'k',lw=2)
ax.set_ylim([0.8,2.25])
ax.set_xlim([-1.0,7])
ax.set_yticks([1.,1+(1/6.),1+(2/6.),1+(3/6.),1+(4./6),1+(5./6),2])
ax.set_yticklabels(['$f_0$','$f_1$','$f_2$','$f_3$','$f_4$','$f_5$',r'$f_{6}$'])
ax.set_ylabel(r'$f$', rotation='horizontal')
ax.yaxis.set_label_coords(-0.09,0.95)

I would like yticklabels "f_0" ... "f_6" to be aligned with ytick so that the top of the superscript is at label level; so I would need to lower the position, perhaps by two mm.
I know that I can “stuff” shortcuts, but I don’t know how to change the vertical position. (At the moment I am adding my labels to the keynote, which is clearly not perfect.)
:
,
xticklabels xticks
https://gorelik.net/2017/11/23/how-to-make-a-graph-less-readable-rotate-the-text-labels/
. , , :
fig,ax=plt.subplots(1)
ax.plot(n.linspace(0,5,80),1+(n.linspace(0,5,80)/6.),'k',lw=2)
ax.set_ylim([0.8,2.25])
ax.set_xlim([-1.0,7])
ax.set_yticks([1.,1+(1/6.),1+(2/6.),1+(3/6.),1+(4./6),1+(5./6),2])
ax.set_ylabel(r'$f$', rotation='horizontal')
ax.yaxis.set_label_coords(-0.09,0.95)
labels=ax.set_yticklabels(['$f_0$','$f_1$','$f_2$','$f_3$','$f_4$','$f_5$',r'$f_{6}$'])
for i, label in enumerate(labels):
label.set_y(label.get_position()[1] - 100.)
, :
matplotlib?
, set_y ( ). , , yticklabel, , . , , , , , .