Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] GR backend, PDF output, transparent background: opacity of grid lines differs #4992

Open
stepanzh opened this issue Sep 28, 2024 · 0 comments
Labels

Comments

@stepanzh
Copy link

Details

GR backend does not respect opacity of x-grid lines when saving to PDF with background=:transparent (while saving to PNG is OK). The original issue comes from stackoverflow, https://stackoverflow.com/questions/79007982/dark-vertical-lines-in-a-transparent-plot.

The issue seems independent of PDF viewer (tested in Preview, Skim, Acrobat Reader, Mozilla). The screenshots below are from Preview (a default PDF viewer on MacOS).

Example 1 - Single plot

Note that opacity differs for x- and y-grid lines.

using Plots
gr()

grid = (:both, :red, :solid, 5, 0.25)

plot(; background=:transparent, grid=grid)
savefig("first.pdf")
first-pdf

Example 2 - Multiple plots

Surprisingly, rendering of grid lines is normal for subplots, except first.

using Plots
gr()

grid = (:both, :red, :solid, 5, 0.25)

plot(; layout=(2, 2))
plot!(; background=:transparent, grid=grid)
plot!(; background=:transparent, grid=grid)
plot!(; background=:transparent, grid=grid)
plot!(; background=:transparent, grid=grid)
savefig("both.pdf")
both-pdf

Backends

This bug occurs on ( insert x below )

Backend yes no untested
gr (default) x
pythonplot x
plotlyjs x
pgfplotsx x
unicodeplots x
inspectdr x
gaston x

Versions

Plots.jl version: 1.40.8
Backend version (]st -m <backend(s)>): 0.73.7
Output of versioninfo():

Julia Version 1.10.4
Commit 48d4fd48430 (2024-06-04 10:41 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 10 × Apple M2 Pro
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 6 virtual cores)
@stepanzh stepanzh added the bug label Sep 28, 2024
@stepanzh stepanzh changed the title [BUG] [BUG] GR backend, PDF output, transparent background: opacity of grid lines differs Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant