I'm trying to show an image with a title that combines normal text with a couple of Latex commands:
plt.imshow(w1subtracted2, origin='lower',
extent=[l_max, -l_max, -b_max, b_max],
cmap = color_map)
plt.title('W1 disk and central $\pm2\textdegree$ subtracted', fontsize = 'small')
plt.xlabel(xlabel, fontsize = 'small')
plt.ylabel(ylabel, fontsize = 'small')
plt.savefig('w1subtracted2.png')
but I can't get the title showing the \pm
and \textdegree
to show in Latex style. How can I achieve that?
It seems you are not using latex (usetex = True
) but simple MathText. There is no \textdegree
in MathText.
Using
plt.title(r'W1 disk and central $\pm2^\circ$ subtracted', fontsize='small')
should give you
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