1 | initial version |
matplotlib uses its own typsetting system called mathtext by default. I think the problem you are getting is due to mathtext not supporting arrays in math mode?
In any case, you can work around this by telling matplotlib to use your system LaTeX instead of mathtext like this:
from matplotlib import rc
rc('text', usetex=True)
my_matrix = r'$\left( \begin{array}{ll} 2 & 3 \\ 4 & 5 \end{array} \right)$'
text(my_matrix, (1,1))
You can look at another example here, it shows you how to change fonts to match the font in your document.