Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Plotting a latex matrix using text()

I would like to plot a latex'd matrix at a location in a 2d plot. I tried this:

text('$\\left( \\begin{array}{ll} 2 & 3 \\\\ 4 & 5 \\end{array} \\right)$', (1,0) )

and various variations to do with the backslashes being escaped or not. But every time I get an error:

matplotlib.pyparsing.ParseFatalException: Expected end of math '$'
$\left( \begin{array}{ll} 2 & 3 \\ 4 & 5 \end{array} \right)$ (at char 0), (line:1, col:1)

It appears that matplotlib doesn't want to parse an array or a pmatrix etc. Is there a workaround?