Multi-character subscript in Matplotlib when the subscript is a variable

Viewed 515

For a multi-character subscript in Matplotlib, we should put all the characters inside curly braces. For example, if we want 123 as a subscript of N, we should use $N_{123}$. This is working fine as long as I am giving the subscript explicitly. But, my subscript is a variable (say, sub=123). So, when I use the format string method (shown below), all except the first character appear in normal size (shown in the figure).

sub = 123
plt.title("$N_{}$".format(sub))

Image shows only "1" becomes the subscript of N

0 Answers
Related