[python] Superscript in Python plots

I want to label my x axis at follows :

pylab.xlabel('metres 10^1')

But I don't want to have the ^ symbol included .

pylab.xlabel('metres 10$^{one}$')

This method works and will superscript letters but doesn't seem to work for numbers . If I try :

pylab.xlabel('metres 10$^1$')

It superscripts a letter N for some reason .

Anyone know how to superscript numbers in python plots ? thanks .

This question is related to python matplotlib

The answer is


Alternatively, in python 3.6+, you can generate Unicode superscript and copy paste that in your code:

ax1.set_ylabel('Rate (min?ยน)')

If you want to write unit per meter (m^-1), use $m^{-1}$), which means -1 inbetween {}

Example: plt.ylabel("Specific Storage Values ($m^{-1}$)", fontsize = 12 )