Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

latex code of plots

Dear, I'm trying to get the LaTeX code of a given plot. While it works fine in cocalc, I'm not able to get it done in my sageMath environment. It looks like I'm missing some libraries.

s=plot(cos(x),[x,-pi,pi])
show(s)
print(latex(s)) #checkpoint
with open("tmp/demo.tex", 'w') as f:
    f.write(str(latex(s))) #ultimate target
f.close()

Here is the error generated: ValueError: Matplotlib requires either xelatex, lualatex, or pdflatex.

Any idea ?