How to add subscripts and subscripts to coordinates in matplotlib

Viewed 14

I wish to use exponential form in matplotlib's coordinates. So I use the plt.gca().yaxis.set_major_formatter(FuncFormatter(y_update_scale_value)). In my case, exponents are variables. So in the y_update_scale_value(temp, position) function, I use the '2$^{}$'.format(int(temp)) as the return value. But in the image, only the highest bit of the exponent becomes superscript, and the others remain unchanged. The picture below is the effect. It's very ugly, and how should I modify it?

enter image description here

0 Answers
Related