Error with LateX text rendering in matplotlib

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Error with LateX text rendering in matplotlib

SOPHIE FRANCES WEBER
Hello,

My mac laptop's operating system is OS X El Capitan. I use the PyCharm IDE and obtained python, with matplotlib installed, via Enthought Canopy. I am trying to create plots using LateX text rendering (rc('text',usetex=True)), but I keep getting an error saying "RuntimeError: LaTeX was not able to process the following string: 'lp'"  I looked into the most common causes for this, and consequently double checked that my latex installation (with dvipng and ghostscript included) is included in my PATH, and it is; but I still get the error.

Here is a minimal example script, taken from the matplotlib documentation site.

import numpy as np
import matplotlib.pyplot as plt

# Example data
t = np.arange(0.0, 1.0 + 0.01, 0.01)
s = np.cos(4 * np.pi * t) + 2

plt.rc('text', usetex=True)
plt.rc('font', family='serif')
plt.plot(t, s)

plt.xlabel(r'\textbf{time} (s)')
plt.ylabel(r'\textit{voltage} (mV)',fontsize=16)
plt.title(r"\TeX\ is Number "
r"$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
fontsize=16, color='gray')
# Make room for the ridiculously large title.
plt.subplots_adjust(top=0.8)

plt.show()


Any help would be greatly appreciated.
Thanks!


_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Error with LateX text rendering in matplotlib

Jouni K. Seppänen
SOPHIE FRANCES WEBER <[hidden email]> writes:

> Here is a minimal example script, taken from the matplotlib documentation
> site.

I suggest running your minimal test case with the --verbose-debug flag,
and seeing if there is any clue in the messages that appear before the
RuntimeError.

In other words, try

    python testcase.py --verbose-debug

to enable debugging output.

--
Jouni K. Seppänen
http://www.iki.fi/jks

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Error with LateX text rendering in matplotlib

SOPHIE FRANCES WEBER
Hello,
Thank you for your response.  Sorry, this is probably a trivial question, but I'm not sure how to run the --verbose-debug option; I use the pycharm IDE and thus don't have access to the normal python terminal. Is there a workaround to this?

On Sat, Jul 22, 2017 at 10:02 AM, Jouni K. Seppänen <[hidden email]> wrote:
SOPHIE FRANCES WEBER <[hidden email]> writes:

> Here is a minimal example script, taken from the matplotlib documentation
> site.

I suggest running your minimal test case with the --verbose-debug flag,
and seeing if there is any clue in the messages that appear before the
RuntimeError.

In other words, try

    python testcase.py --verbose-debug

to enable debugging output.

--
Jouni K. Seppänen
http://www.iki.fi/jks

_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users


_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/matplotlib-users