简体   繁体   中英

latex failure ipython daft matplotlib

I was keen to try out daft ( http://daft-pgm.org/ ) and through it I found out that latex functionality was not working in matplotlib.

I paste the example on the daft website ( http://daft-pgm.org/examples/nocircles/ ):

from matplotlib import rc
rc("font", family="serif", size=12)
rc("text", usetex=True)

import daft

pgm = daft.PGM([3.6, 2.4], origin = [1.15, 0.8], node_ec="none")
pgm.add_node(daft.Node("cloudy", r"cloudy", 3, 3))
pgm.add_node(daft.Node("rain", r"rain", 2, 2))
pgm.add_node(daft.Node("sprinkler", r"sprinkler", 4, 2))
pgm.add_node(daft.Node("wet", r"grass wet", 3, 1))
pgm.add_edge("cloudy", "rain")
pgm.add_edge("cloudy", "sprinkler")
pgm.add_edge("rain", "wet")
pgm.add_edge("sprinkler", "wet")
pgm.render()
pgm.figure.savefig("nocircles.pdf")
pgm.figure.savefig("nocircles.png", dpi=150)

This is what ipython returns to me

RuntimeError: LaTeX was not able to process the following string:  
'lp'
Here is the full report generated by LaTeX: 

There is no report supplied by ipython or LaTex. See screenshot:

在此输入图像描述

The standard script on the matplotlib website gives me the same error. Is there a way to check if all the dependencies are met? LaTex is installed on my system but I am not sure if ipython can access it.

In my case it was a LaTex library that needed to be installed (sorry I didn't pay attention to which one)

It automatically opened my MikTex installer, so you install the suggested library and you should be done.

There is no need for 'lp' to be accessible from the command line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM