I want to write title in python figure, which contain variable n=100
. I want to write as $t_n=0.1$ (n is subscript). I try as follows:
import matplotlib.pyplot as plt
n=100
plt.figure()
plt.title(f'$t_{n:3d}=0.1$')
plt.show()
But it shows as follows:
It shows that 1 is subscript and 00 is normal text. I want 100 is subscript.
If I change the code into plt.title(f'$t_{{n:3d}}=0.1$')
the result is
The result is not as my desired. So, how to do it?