Is there a way to do indexes / superscripts in Matplotlib without TeX?

I find that TeX messes with my fonts, alignment of the labels of my subtitle labels, etc., and I feel that there should be an easier way to get subcrypts and superscript characters in the plot labels. Help!

+4
source share
2 answers

Just use \mathregular{whatever}in your expression.

For example:

import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.text(0.2, 0.7, 'No mathtex')
ax.text(0.2, 0.5, 'This superscript $is^{in}$ italics')
ax.text(0.2, 0.3, 'While this $\mathregular{is^{really}}$ the same font')
plt.show()

enter image description here

See http://matplotlib.org/users/mathtext.html for more details .

+4
source

, TeX- mathtext ( LaTeX). , , , kwargs horizontalalignment, verticalalignment multialignment ?

: http://matplotlib.org/users/text_props.html

+1

Source: https://habr.com/ru/post/1528168/


All Articles