Skip to content

xflip=true reverses colormaps in saved PDFs with GR backend #5164

@brenhinkeller

Description

@brenhinkeller

Details

compare

A = repeat(1:10,1,10) # Test image with an obvious pattern
h = heatmap(A)
savefig(h, "test.pdf") # Works as normal

with

A = repeat(1:10,1,10) # Test image with an obvious pattern
hr = heatmap(A, xflip=true)
savefig(hr, "test_xflip.pdf") # Colorscale is now reversed

This does not appear to affect other file types (PNG and SVG tested normal, only PDF is reversed so far), and impact both heatmaps and at least some other images (I originally noticed this in an externally-scaled image annotated using Plots here).

Backends

This bug occurs on ( insert x below )

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

Versions

Plots.jl version: [91a5bcdd] Plots v1.40.17
Backend version (]st -m <backend(s)>): [28b8d3ca] GR v0.73.17
Output of versioninfo():

Julia Version 1.11.6
Commit 9615af0f269 (2025-07-09 12:58 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin24.0.0)
  CPU: 10 × Apple M1 Max
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, apple-m1)
Threads: 8 default, 0 interactive, 4 GC (on 8 virtual cores)
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 8

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions