# Ploting LARGE heatmaps? Plots.jl in GPU?

**URL:** https://discourse.julialang.org/t/ploting-large-heatmaps-plots-jl-in-gpu/94033
**Category:** General Usage
**Tags:** package, plots, glmakie
**Created:** [February 4, 2023, 9:46am UTC](https://discourse.julialang.org/t/ploting-large-heatmaps-plots-jl-in-gpu/94033 "2023-02-04T09:46:32Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![marianoarnaiz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marianoarnaiz/32/19377_2.png) [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)
#### Post date: [February 4, 2023, 9:46am UTC](https://discourse.julialang.org/t/ploting-large-heatmaps-plots-jl-in-gpu/94033/1 "2023-02-04T09:46:32Z")

</div>

Hi all.  
I have this matrix that has a size of 3250x55650 and it is just a sample of my raw data.  
I have a few files much larger.

I need to make heatmaps but Plots.jl is a bit slow on CPU when I run these lines

> p1=heatmap(tticks,offset,strainrate,color=:viridis, clims=(-2000,2000))  
> plot(p1,size=(1600,800))

Is it maybe a best way to handle very big matrix for fast plotting? Maybe plotting on GPU (I have a MacBook Air with an M1 Chip).

Thanks in advance 🙂

---

<div class="post-metadata">

### Author: ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)
#### Post date: [February 4, 2023, 9:56am UTC](https://discourse.julialang.org/t/ploting-large-heatmaps-plots-jl-in-gpu/94033/2 "2023-02-04T09:56:35Z")

</div>

Makie?

---

<div class="post-metadata">

### Author: ![marianoarnaiz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marianoarnaiz/32/19377_2.png) [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)
#### Post date: [February 4, 2023, 10:01am UTC](https://discourse.julialang.org/t/ploting-large-heatmaps-plots-jl-in-gpu/94033/3 "2023-02-04T10:01:55Z")

</div>

Never tried Makie. Is it fast and does it work with GPU?

---

<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: [February 4, 2023, 10:20am UTC](https://discourse.julialang.org/t/ploting-large-heatmaps-plots-jl-in-gpu/94033/4 "2023-02-04T10:20:10Z")

</div>

GLmakie uses the GPU and should be quite fast although I have never used it on this kind of scale

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [February 4, 2023, 11:43am UTC](https://discourse.julialang.org/t/ploting-large-heatmaps-plots-jl-in-gpu/94033/5 "2023-02-04T11:43:45Z")

</div>

Fyi, the [InteractiveViz](https://docs.juliahub.com/InteractiveViz/AYpiK/0.1.3/) package looks very interesting.

It takes ~1 s to display a 3250 x 55650 heatmap (~180M points, not all displayed as it is pointless) and zooming in and out is instantaneous (bringing more points in, as needed):

```julia
using InteractiveViz, GLMakie
strainrate = sind.((1:3250) .* (1:55650)'/5e4)
iheatmap(strainrate; cursor=true)

```

 ![InteractiveViz_GLMakie_3250x55650](https://global.discourse-cdn.com/julialang/original/3X/b/e/beddfe3155ee2dc99e11277567e5020a94e8c8f5.png)

with interactive zoom-in and cursor info:

 ![InteractiveViz_GLMakie_3250x55650_zoom-in](https://global.discourse-cdn.com/julialang/original/3X/2/b/2b93160928eeee6ca77976f76379f26f02cb940e.png)

---

<div class="post-metadata">

### Author: ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)
#### Post date: [February 4, 2023, 8:54pm UTC](https://discourse.julialang.org/t/ploting-large-heatmaps-plots-jl-in-gpu/94033/6 "2023-02-04T20:54:05Z")

</div>

Does it have 3D?

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [February 4, 2023, 9:06pm UTC](https://discourse.julialang.org/t/ploting-large-heatmaps-plots-jl-in-gpu/94033/7 "2023-02-04T21:06:04Z")

</div>

No

---

<div class="post-metadata">

### Author: ![marianoarnaiz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marianoarnaiz/32/19377_2.png) [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)
#### Post date: [February 5, 2023, 6:58pm UTC](https://discourse.julialang.org/t/ploting-large-heatmaps-plots-jl-in-gpu/94033/8 "2023-02-05T18:58:07Z")

</div>

> [@marianoarnaiz](#):
>
> Hi all.  
> I have this matrix that has a size of 3250x55650 and it is just a sample of my raw data.  
> I have a few files much larger.
> 
> I need to make heatmaps but Plots.jl is a bit slow on CPU when I run these lines
> 
> > p1=heatmap(tticks,offset,strainrate,color=:viridis, clims=(-2000,2000))  
> > plot(p1,size=(1600,800))
> 
> Is it maybe a best way to handle very big matrix for fast plotting? Maybe plotting on GPU (I have a MacBook Air with an M1 Chip).
> 
> Thanks in advance 🙂

This is great but there are some limitations like no color bar ☹

---

<div class="post-metadata">

### Author: ![marianoarnaiz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marianoarnaiz/32/19377_2.png) [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)
#### Post date: [February 5, 2023, 6:58pm UTC](https://discourse.julialang.org/t/ploting-large-heatmaps-plots-jl-in-gpu/94033/9 "2023-02-05T18:58:58Z")

</div>

Not really working on my computer (MacBook Air M1) getting this error when using large data sets:  
UNSUPPORTED (log once): POSSIBLE ISSUE: unit 1 GLD\_TEXTURE\_INDEX\_1D is unloadable and bound to sampler type (Float) - using zero texture because texture unloadable

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [February 5, 2023, 9:36pm UTC](https://discourse.julialang.org/t/ploting-large-heatmaps-plots-jl-in-gpu/94033/10 "2023-02-05T21:36:50Z")

</div>

> [@marianoarnaiz](#):
>
> This is great but there are some limitations like no color bar ☹

Indeed, but I guess fixing it should be a piece of cake for the Makie gurus.

Now I can’t run the code anymore, I get errors:

```julia
ERROR: No backend available (GLMakie, CairoMakie, WGLMakie)!

```

But I think the following commands add a colorbar on the left side:

```julia
fig = Figure()
iheatmap(strainrate; cursor=true); 
Colorbar(fig[1,-1], limits=(-1, 1), colormap=:viridis, flipaxis=false)

```

Perhaps some left padding can be added to the plot.

---

<div class="post-metadata">

### Author: ![marianoarnaiz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marianoarnaiz/32/19377_2.png) [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)
#### Post date: [February 13, 2023, 12:57pm UTC](https://discourse.julialang.org/t/ploting-large-heatmaps-plots-jl-in-gpu/94033/11 "2023-02-13T12:57:52Z")

</div>

> [@rafael.guerra](#):
>
> ```julia
> fig = Figure()
> iheatmap(strainrate; cursor=true); 
> Colorbar(fig[1,-1], limits=(-1, 1), colormap=:viridis, flipaxis=false)
> 
> ```

Did not work for me ☹

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [February 13, 2023, 3:20pm UTC](https://discourse.julialang.org/t/ploting-large-heatmaps-plots-jl-in-gpu/94033/12 "2023-02-13T15:20:48Z")

</div>

> [@marianoarnaiz](#):
>
> Did not work for me

```julia
Colorbar(fig[-1,-1], limits=(-1, 1), colormap=:viridis, flipaxis=false)

```

Produces a colorbar, but it is on top of the y-axis:

 ![InteractiveViz_GLMakie_colorbar](https://global.discourse-cdn.com/julialang/original/3X/1/2/12da36ecfaaee564530722d22045701481d1acb0.png)

---

<div class="post-metadata">

### Author: ![marianoarnaiz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/marianoarnaiz/32/19377_2.png) [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)
#### Post date: [February 13, 2023, 7:20pm UTC](https://discourse.julialang.org/t/ploting-large-heatmaps-plots-jl-in-gpu/94033/13 "2023-02-13T19:20:37Z")

</div>

It worked this time. I was trying to link it to Axis in Makie, but it didn´t work. It is a great package, it is a shame it is still in development hehe. Thanks @rafael.guerra
