# Issues with saving plot as pdf

**URL:** <https://discourse.julialang.org/t/issues-with-saving-plot-as-pdf/46358>\
**Category:** General Usage\
**Tags:** plotting\
**Created:** [September 10, 2020, 5:12am UTC](https://discourse.julialang.org/t/issues-with-saving-plot-as-pdf/46358 "2020-09-10T05:12:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhache](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bhache/32/15670_2.png) [@bhache](https://discourse.julialang.org/u/bhache)\
**Post date:** [September 10, 2020, 5:12am UTC](https://discourse.julialang.org/t/issues-with-saving-plot-as-pdf/46358/1 "2020-09-10T05:12:51Z")

</div>

I was trying to save plots generated using gr() backend in pdf format and this messes up the negative values along y-axes. This doesn’t seem to happen when the figure is saved as png though. I am attaching the plot command I used below

```julia
plot(
        t,
        [4 * sum(I_nAChR, dims = 2), 4 * sum(I_SK2, dims = 2), PSC],
        lw = [1.5 1.5 3],
        color = [RGB{Float64}(0.0, 0.6056031611752245, 0.9786801175696073) :magenta RGB{
                Float64,
        }(
                0.2422242978521988,
                0.6432750931576305,
                0.3044486515341153,
        )],
        fontfamily = font(48, "helvetica"),
        xlabel = "t (ms)",
        ylabel = "I (pA)",
        label = [L"\textrm{I}_\textrm{nAChR}" L"\textrm{I}_\textrm{SK2}" L"\textrm{PSC}"],
        title = "Efferent stimulation at 50 Hz",
        foreground_color_legend = nothing,
)

```

**Plot saved as pdf**

 ![Screen Shot 2020-09-10 at 1.09.52 AM](https://global.discourse-cdn.com/julialang/original/3X/4/8/48ed2c58ebb37294338302f1d0f910632ae037f5.png)

I am not sure what is going wrong here.

---

<div class="post-metadata">

**Author:** ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Post date:** [September 10, 2020, 12:44pm UTC](https://discourse.julialang.org/t/issues-with-saving-plot-as-pdf/46358/2 "2020-09-10T12:44:47Z")

</div>

I cannot replicate this issue on MacOS Plots v1.6.0.

My suggestion would be to take out plot elements and check whether the problem disappears at some point. In other words: do you have the same problem with the simplest

`plot(1:20, -10:9)`

or do you need to add one of the formatting instructions for the problem to appear?

---

<div class="post-metadata">

**Author:** ![bhache](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bhache/32/15670_2.png) [@bhache](https://discourse.julialang.org/u/bhache)\
**Post date:** [September 10, 2020, 1:50pm UTC](https://discourse.julialang.org/t/issues-with-saving-plot-as-pdf/46358/3 "2020-09-10T13:50:13Z")

</div>

> [@bhache](#):
>
> `fontfamily = font(48, "helvetica"),`

Hi hendri54, thank you for the suggestion, I tried to use the MWE as below

```julia
plot(1:20, -10:9)

```

I was able to isolate the issue to this following line while retaining the rest in the plot() that I was using

```julia
fontfamily = font(48, "helvetica"),

```

**Saved plot without the line above in the plot function**  
 ![test](https://global.discourse-cdn.com/julialang/original/3X/7/6/76190c51eb4b9a7addf3e7451d38d234820443ed.png)

I am using MacOS Plots v1.6.3 with Julia v1.5.1.

---

<div class="post-metadata">

**Author:** ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Post date:** [September 11, 2020, 11:52am UTC](https://discourse.julialang.org/t/issues-with-saving-plot-as-pdf/46358/4 "2020-09-11T11:52:32Z")

</div>

Funny - that was the first thing I tried on my machine, but it made no difference.

My suggestion: try to downgrade to Plots v1.6.0. Then file an issue.

---

<div class="post-metadata">

**Author:** ![bhache](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bhache/32/15670_2.png) [@bhache](https://discourse.julialang.org/u/bhache)\
**Post date:** [September 14, 2020, 9:22pm UTC](https://discourse.julialang.org/t/issues-with-saving-plot-as-pdf/46358/5 "2020-09-14T21:22:44Z")

</div>

Ah, I see. I will try to downgrade and see if that changes things. For now, I just decided to leave the font settings out. Thank you for your suggestions @hendri54, much appreciated 🙂 .

---

<div class="post-metadata">

**Author:** ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Post date:** [September 15, 2020, 12:15am UTC](https://discourse.julialang.org/t/issues-with-saving-plot-as-pdf/46358/6 "2020-09-15T00:15:26Z")

</div>

The odd thing is, it’s now happening with some of my plots as well (no font settings, except what the theme sets).

I will file an issue if it persists

---

<div class="post-metadata">

**Author:** ![luboshanus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/luboshanus/32/12163_2.png) [@luboshanus](https://discourse.julialang.org/u/luboshanus)\
**Post date:** [June 8, 2021, 8:29am UTC](https://discourse.julialang.org/t/issues-with-saving-plot-as-pdf/46358/7 "2021-06-08T08:29:51Z")

</div>

Hi,

Is there any update about plotting and saving to PDF with different font such as Palatino (Mac) and not having problems with the minus sign in front of numbers on axes?

Thanks a lot in advance!

Luboš
