I am running a simple code and trying to save a plot created with pyplot() in pdf or eps.
μs = log.(xs)
σs = rand(length(xs))
When I try save("filename.pdf") the file is not saved. Only png actually works. Shouldn't pyplot support eps and pdf?
If you use PyPlot with PyCall :
- create a figure first, e.g.,
fig = figure("myfigure",figsize=(5,5))
- then add your code from above (which adds the plot to the figure)
- save it to pdf with
- close the figure with
If you use Plots.jl with pyplot() backend, save the plot in a variable first:
p = plot(xs,μs,grid=false)
then save it:
It works great with that simple code. But if change the legend font type, and try to repeat your procedure I get like
PyError ($(Expr(:escape, :(ccall(#= /Users/user/.juliapro/JuliaPro_v1.2.0-1/packages/PyCall/ttONZ/src/pyfncall.jl:44 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class ‘RuntimeError’>
RuntimeError(‘TrueType font is missing table’)