# REPL crash from attempting a heatmap plot with a large dataset

**URL:** <https://discourse.julialang.org/t/repl-crash-from-attempting-a-heatmap-plot-with-a-large-dataset/103112>\
**Category:** Visualization\
**Tags:** cairomakie\
**Created:** [August 23, 2023, 2:14pm UTC](https://discourse.julialang.org/t/repl-crash-from-attempting-a-heatmap-plot-with-a-large-dataset/103112 "2023-08-23T14:14:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![CosmicSpittle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cosmicspittle/32/24028_2.png) [@CosmicSpittle](https://discourse.julialang.org/u/CosmicSpittle)\
**Post date:** [August 23, 2023, 2:14pm UTC](https://discourse.julialang.org/t/repl-crash-from-attempting-a-heatmap-plot-with-a-large-dataset/103112/1 "2023-08-23T14:14:10Z")

</div>

I seemed to be up against a limit on the size of dataset that CairoMakie can handle. I am trying to plot a heatmap of a large spectrogram from DSP.jl. I’ve reduced the problem I’m having to a size issue. Oddly, I was not getting an error message…the REPL would just unceremoniously kill itself.

I can reproduce (on my system) with this:

```julia
using CairoMakie
using ColorSchemes

num = 20000
row = range(1, num)
col = range(1, num*3)
val = rand(1:1:5,num, num*3)

fig = Figure(resolution = (1800, 800), fontsize = 30)
ax = Axis(fig[1,1]; xlabel = "time", ylabel = "freq", title = "Insert clever title here")
hm = CairoMakie.heatmap!(row, col, val; colormap = Reverse(:Blues_9))
fig

```

However, if I reduce num to 15,000, then I get this error message:

```julia
Error showing value of type Figure:
ERROR: Cairo stops rendering images bigger than 32745, which is likely a bug in Cairo. Please resample your image/heatmap with e.g. `ImageTransformations.imresize`

```

If I reduce the value of num to 10,000, then I get a heatmap.

I see I will need to downsample, but is the due to CairoMakie or my machine’s memory? Why error at some level and at a higher level, the REPL just crashes?

Is there some way to downsample only the y axis (freq) but keep the x (time) axis intact, perhaps with a scroll bar?

Thanks!

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [August 23, 2023, 2:31pm UTC](https://discourse.julialang.org/t/repl-crash-from-attempting-a-heatmap-plot-with-a-large-dataset/103112/2 "2023-08-23T14:31:34Z")

</div>

We found this value by trial and error in Cairo, which doesn’t throw any error and doesn’t mention this behavior in the docs…  
You can use `Images.imresize(val, (xres, yres))` for downsampling… Or something like that

---

<div class="post-metadata">

**Author:** ![Salmon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/salmon/32/22968_2.png) [@Salmon](https://discourse.julialang.org/u/Salmon)\
**Post date:** [August 23, 2023, 3:48pm UTC](https://discourse.julialang.org/t/repl-crash-from-attempting-a-heatmap-plot-with-a-large-dataset/103112/3 "2023-08-23T15:48:32Z")

</div>

Would it be an option to switch to GLMakie for this?

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [August 23, 2023, 4:09pm UTC](https://discourse.julialang.org/t/repl-crash-from-attempting-a-heatmap-plot-with-a-large-dataset/103112/4 "2023-08-23T16:09:20Z")

</div>

GLMakie also has limits by the GPU for the heatmap size, they may even be smaller, depending on the gpu vendor…  
This is currently the best bet:[Frequently Asked Questions · Makie](https://docs.makie.org/stable/documentation/faq/index.html#dimensions_too_large)  
😅
