Details
When plotting with heatmap(x, y, z::matrix) and a logarithmic xscale, setting xlims causes the heatmap output to shift to an incorrect position on the x axis.
The same happens when first plotting using heatmap(x, y, z::matrix) and then plotting 2D data, even without explicitly setting xlims, The 2D data is plotted in the correct location.
This also occurs when using :ln or :log2 and scatter instead of plot.
The expected output can be observed when using plotly or pyplot (for :log10).
Minimal working example:
using Plots
function test_bug()
x = [10.0^x for x in 0:1]
A = zeros(2, 2)
heatmap(x, 1:2, A, xscale=:log10,
xlims=[10.0^-1, 10.0^2]
)
#plot!(x, x -> 1.8, label="")
end
function demonstrate()
gr()
gui(test_bug())
plotly()
gui(test_bug())
pyplot()
gui(test_bug())
end
When commenting the xlims=.. line and uncommenting the plot! call, the same behaviour occurs.
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.2
Backend version: GR: 0.73.3, PlotlyBase 0.8.19 & PlotlyKaleide 2.2.4, PyPlot 2.11.2
Output of versioninfo():
Julia Version 1.10.2
Commit bd47eca2c8 (2024-03-01 10:14 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 4 × Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
Threads: 4 default, 0 interactive, 2 GC (on 4 virtual cores)
Environment:
JULIA_NUM_THREADS = auto
Details
When plotting with
heatmap(x, y, z::matrix)and a logarithmicxscale, settingxlimscauses theheatmapoutput to shift to an incorrect position on the x axis.The same happens when first plotting using
heatmap(x, y, z::matrix)and then plotting 2D data, even without explicitly settingxlims, The 2D data is plotted in the correct location.This also occurs when using
:lnor:log2andscatterinstead ofplot.The expected output can be observed when using plotly or pyplot (for
:log10).Minimal working example:
When commenting the
xlims=..line and uncommenting theplot!call, the same behaviour occurs.Backends
This bug occurs on ( insert
xbelow )Versions
Plots.jl version: 1.40.2
Backend version: GR: 0.73.3, PlotlyBase 0.8.19 & PlotlyKaleide 2.2.4, PyPlot 2.11.2
Output of
versioninfo():Julia Version 1.10.2
Commit bd47eca2c8 (2024-03-01 10:14 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 4 × Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, skylake)
Threads: 4 default, 0 interactive, 2 GC (on 4 virtual cores)
Environment:
JULIA_NUM_THREADS = auto