# IJulia: Save a Image from PyPlot as PDF in JupyterLab

**URL:** <https://discourse.julialang.org/t/ijulia-save-a-image-from-pyplot-as-pdf-in-jupyterlab/12880>\
**Category:** Visualization\
**Tags:** jupyter\
**Created:** [August 4, 2018, 5:53am UTC](https://discourse.julialang.org/t/ijulia-save-a-image-from-pyplot-as-pdf-in-jupyterlab/12880 "2018-08-04T05:53:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![v-i-s-h](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/v-i-s-h/32/46152_2.png) [@v-i-s-h](https://discourse.julialang.org/u/v-i-s-h)\
**Post date:** [August 4, 2018, 5:53am UTC](https://discourse.julialang.org/t/ijulia-save-a-image-from-pyplot-as-pdf-in-jupyterlab/12880/1 "2018-08-04T05:53:49Z")

</div>

Hi,

I use jupyter-lab with IJulia kernel for my research. I use PyPlot for my plotting.  
When using normal Julia scripts, I’m able to use

```julia
figure()
# ... Code to Plot data...
savefig( "my_results.pdf", bbox_inches = "tight", pad_inches = 0.1 )

```

to save the figure as PDF format.

But if I try to execute the same code from JupyterLab with IJulia, I get blank PDF file. Right now the work around is to save the Image but right clicking and saving it as default PNG image. But this creates problems when I zoom into the saved figure. Hence I want to get PDF figure. (SVG is also an option, but if I want to put the image to latex, SVG is not supported AFAIK.)

How can I export a image I plotted in my notebook using PyPlot as a PDF figure?

With Regards,  
v-i-s-h

---

<div class="post-metadata">

**Author:** ![rickhg12hs](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rickhg12hs/32/5926_2.png) [@rickhg12hs](https://discourse.julialang.org/u/rickhg12hs)\
**Post date:** [August 23, 2018, 2:54pm UTC](https://discourse.julialang.org/t/ijulia-save-a-image-from-pyplot-as-pdf-in-jupyterlab/12880/2 "2018-08-23T14:54:29Z")

</div>

I don’t know the complete answer, but if you execute `savefig` in the same notebook cell as all the other plot commands, it works.
