Issues with saving plot as pdf

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

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

I am not sure what is going wrong here.

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?

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

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

fontfamily = font(48, "helvetica"),

Saved plot without the line above in the plot function
test

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

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.

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 :slight_smile: .

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

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š