You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
functiontest_bug()
x = [10.0^x for x in0: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="")endfunctiondemonstrate()
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.
x = collect(LinRange(0.001,4,1001))
y = 1:10
z = exp.(-x) * y'
xlog10 = log10.(x)
plot(
heatmap(x, y, z, xscale = :log10, title = "Ideal", color=:plasma),
heatmap(xlog10, y, z, xformatter = xx -> "10^{$(Int(xx))}", title = "Non-ideal", color=:plasma)
)
The "ideal" construction doesn't produce the right output
Details
When plotting with
heatmap(x, y, z::matrix)
and a logarithmicxscale
, settingxlims
causes theheatmap
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 settingxlims
, The 2D data is plotted in the correct location.This also occurs when using
:ln
or:log2
andscatter
instead 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
x
below )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
The text was updated successfully, but these errors were encountered: