Plots, heatmap and xlim

Dear all,

We just came across a weird behaviour when using (inapproriately) xlim.
In the MWE below, x and y axis are arrays/ranges of very large numbers (say a map of ~1000 km width/height given in unit meters, so order 1e6 ) and xlim values are (by error) provided in unit km (so order 1e3).
The execution of heatmap command stalls and ends up using memory until crash (commented line). This behaviour happened on windows and macs. I realise that it is related to an incorrect combination of dimensions but I still would not expect this to trigger a crash (I would rather expect a massive zoom on a portion of the map). Does anyone know why this triggers a crash?

edit: crash was observed with gr


using Plots
x = LinRange(0., 1.0, 100) .*1e6
y = LinRange(0., 1.2, 100) .*1e6
f = rand(length(x), length(y))
heatmap(x, y, f') # this one works
# heatmap(x, y, f', xlim=(0,1000.)) # this one stalls and ends up crashing

Both heatmaps run fine for me on Linux and gr backend.

julia> versioninfo()
Julia Version 1.8.3
Commit 0434deb161e (2022-11-14 20:14 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 6 × Intel(R) Core(TM) i7-3960X CPU @ 3.30GHz
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, sandybridge)
  Threads: 1 on 6 virtual cores

(@v1.8) pkg> status Plots
Status `~/.julia/environments/v1.8/Project.toml`
⌃ [91a5bcdd] Plots v1.36.5

EDIT: They still work fine after Pkg.update() bringing Plots to v1.38.6.

thanks for having checked!
I will also try on a linux machine and with similar versions for curiosity…

1 Like