# Plots pyplot() export to pdf or eps (ERROR)

**URL:** https://discourse.julialang.org/t/plots-pyplot-export-to-pdf-or-eps-error/29332
**Category:** General Usage
**Tags:** plotting
**Created:** [September 30, 2019, 3:35pm UTC](https://discourse.julialang.org/t/plots-pyplot-export-to-pdf-or-eps-error/29332 "2019-09-30T15:35:31Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![juliauser](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@juliauser](https://discourse.julialang.org/u/juliauser)
#### Post date: [September 30, 2019, 3:35pm UTC](https://discourse.julialang.org/t/plots-pyplot-export-to-pdf-or-eps-error/29332/1 "2019-09-30T15:35:31Z")

</div>

Hi,

I am running a simple code and trying to save a plot created with pyplot() in pdf or eps.

```nohighlight
μs = log.(xs)
σs = rand(length(xs))
plot(xs,μs,grid=false)

When I try save("filename.pdf") the file is not saved. Only png actually works. Shouldn't pyplot support eps and pdf?
```

---

<div class="post-metadata">

### Author: ![mike\_k](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mike_k/32/211864_2.png) [@mike\_k](https://discourse.julialang.org/u/mike_k)
#### Post date: [September 30, 2019, 5:11pm UTC](https://discourse.julialang.org/t/plots-pyplot-export-to-pdf-or-eps-error/29332/2 "2019-09-30T17:11:22Z")

</div>

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 `savefig("myfig.pdf")`
- close the figure with `close(fig)`

If you use Plots.jl with pyplot() backend, save the plot in a variable first:

```julia
p = plot(xs,μs,grid=false)

```

then save it: `savefig(p, "myfigure.pdf")`

---

<div class="post-metadata">

### Author: ![juliauser](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@juliauser](https://discourse.julialang.org/u/juliauser)
#### Post date: [September 30, 2019, 5:20pm UTC](https://discourse.julialang.org/t/plots-pyplot-export-to-pdf-or-eps-error/29332/3 "2019-09-30T17:20:10Z")

</div>

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’)
