JuliaPlots / StatsPlots.jl

Statistical plotting recipes for Plots.jl
Other
437 stars 88 forks source link

PDF is blurry for some viewers #464

Open ulysses4ever opened 3 years ago

ulysses4ever commented 3 years ago

I'm using the example from the documentation modulo blocking interactive plotting (GKSwstype stuff) and saving the result in PDF specifically:

ENV["GKSwstype"] = "nul"
using RDatasets, StatsPlots
iris = dataset("datasets", "iris")
@df iris marginalhist(:PetalLength, :PetalWidth)
savefig("out.pdf")

In many viewers I have access to it looks as expected, e.g. in Evince: 2021-09-06_20-09-1630975318

But in some viewers it's very blurry, e.g.: Firefox 91 (Linux): 2021-09-06_20-09-1630975330

Curiously, the only histogram example I see in Plots' tutorial works just fine in all problematic viewers:

x = 1:10; y = rand(10, 4);
histogram(x, y)
savefig("out2.pdf")

Also, the problem persists with histogram2d. So, it seems there's something slightly off with the 2D stuff, in particular.

Examples of other viewers I had trouble with: all three major browsers on IPad; MacOS' Preview. So it's not Firefox-only problem or even browser-viewers only.

Environment: Julia 1.5 and 1.6, Linux.

I have a workaround: generate SVG (or something) and convert it to PDF by other means (e.g. inkskape), but I would much rather generate PDF right away.