# Grid in Heatmap

**URL:** <https://discourse.julialang.org/t/grid-in-heatmap/77017>\
**Category:** Visualization\
**Tags:** plots, makie\
**Created:** [February 24, 2022, 1:32pm UTC](https://discourse.julialang.org/t/grid-in-heatmap/77017 "2022-02-24T13:32:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qfl3x](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qfl3x/32/16227_2.png) [@Qfl3x](https://discourse.julialang.org/u/Qfl3x)\
**Post date:** [February 24, 2022, 1:32pm UTC](https://discourse.julialang.org/t/grid-in-heatmap/77017/1 "2022-02-24T13:32:12Z")

</div>

Hi, I’m working on a simple A-star viz and was wondering if it’s possible to plot a grid on a heatmap. My current heatmap on Makie looks like:

 ![curr](https://global.discourse-cdn.com/julialang/original/3X/d/d/dd08205624af1c155e82ac4d62f3a80844d3e93c.png)

I want it to have grids, preferably a Major grid (every 5-10 ticks) and a Minor grid (every tick).

Code:

```julia
using Makie
using ColorSchemes, Colors

arr = zeros(Int, 100,100)
arr[35:55,30] .= 1
arr[90,95] = 3

cmap = ColorScheme([colorant"white", colorant"black", colorant"green"])

f = Figure()
ax = Axis(f[1,1], xminorticksvisible=true, xminorgridvisible=true, yminorticksvisible=true, yminorgridvisible=true,
        xticks=0:5:100, yticks=0:5:100, xminorticks=0:1:100, yminorticks=0:1:100)

hidedecorations!(ax, grid=false, minorgrid=false)
heatmap!(ax, arr, colormap=cmap)

```

If I don’t set the 1’s and 3 values (Only zeros array) I get something close to what I want:

 ![curr](https://global.discourse-cdn.com/julialang/original/3X/7/a/7a373ebc2a39c895305c3bc8686918d1bbcdf8a9.png)

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [February 24, 2022, 3:07pm UTC](https://discourse.julialang.org/t/grid-in-heatmap/77017/2 "2022-02-24T15:07:49Z")

</div>

You could try `hm = heatmap!(ax...` and then `translate!(hm, 0, 0, -1000)` or something like that, because the grid lines are behind the heatmap

---

<div class="post-metadata">

**Author:** ![Qfl3x](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/qfl3x/32/16227_2.png) [@Qfl3x](https://discourse.julialang.org/u/Qfl3x)\
**Post date:** [February 25, 2022, 7:05am UTC](https://discourse.julialang.org/t/grid-in-heatmap/77017/3 "2022-02-25T07:05:03Z")

</div>

That worked at `-15`, `-1000` was too much. Thanks. But now that I think about it, there should be a way to to overlay one Axis on top of another.
