I have the following axis labels and legend.
plt.ylabel("ratio_2") plt.xlabel("n_1") plt.legend(('alpha_1','alpha_2' ), loc = 'best',shadow = True)
Right-click on the highlighted text and go to “Format axis title”. 5. Select the “Font” tab. To make characters into superscripts or subscripts, check the appropriate box in the lower left portion of the dialogue box.
The Matplotlib also provides a way to write subscripts or superscripts using the dollar sign. To make subscripts, you have to write the expression inside the dollar sign using the _ and ^ symbols. If you use the _ symbol, the superscript will be under the character.
Edit one of the resulting labels and place your cursor where you want a subscript or superscript. While holding down the ALT-key on your keyboard, type the UNICODE associated with the desired superscript or subscript. For example, type 0179 while holding the ALT-key to get a superscript 3.
Put dollar signs around the formula: plt.xlabel("$n_1$")
The easiest way I know is to enable TeX mode for matplotlib,
from http://www.scipy.org/Cookbook/Matplotlib/UsingTex:
from matplotlib import rc rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) rc('text', usetex=True)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With