Plots.jl
Plots.jl copied to clipboard
[BUG] Colorbar colors don't match actual colors in `contourf` plot
Details
Using specified levels with the contourf function, I get colorbar colors that don’t match the plot. This happens when using the GR backend. The Plotly/PlotlyJS backends claim not to support arbitrary contour levels, so this can't be tested with that backend. Here is an example:
julia> z = 50 .- ((-5:5).^2 .+ ((-5:5).^2)');
julia> contourf(z, levels=[0,20,30,45,50], fillcolor=:lightrainbow, clabels=true)
This produces this plot where the 20 to 30 band in the plot doesn’t have the same color as shown on the colorbar for that range:
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: Plots v1.40.4
Backend version (]st -m <backend(s)>): GR v0.73.6
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: 8 × Apple M2
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 4 default, 0 interactive, 2 GC (on 4 virtual cores)
Environment:
JULIA_EDITOR = code
DYLD_FALLBACK_LIBRARY_PATH = [super long path with lots of Julia artifact directories elided]