# How to plot heat maps with grid lines in \`Plots.jl\` with \`GR\` as backend?

**URL:** <https://discourse.julialang.org/t/how-to-plot-heat-maps-with-grid-lines-in-plots-jl-with-gr-as-backend/91996>\
**Category:** General Usage\
**Tags:** plotting, plots\
**Created:** [December 22, 2022, 10:13am UTC](https://discourse.julialang.org/t/how-to-plot-heat-maps-with-grid-lines-in-plots-jl-with-gr-as-backend/91996 "2022-12-22T10:13:37Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [December 22, 2022, 10:30am UTC](https://discourse.julialang.org/t/how-to-plot-heat-maps-with-grid-lines-in-plots-jl-with-gr-as-backend/91996/2 "2022-12-22T10:30:11Z")

</div>

You can use `vline!` and `hline!`:

```julia
using Plots

M = rand(4, 5)
heatmap(M)
m, n = size(M)
vline!(0.5:(n+0.5), c=:black)
hline!(0.5:(m+0.5), c=:black)

```

And the usual line attributes: `ls=:dash`, etc.

---

_[View the full topic](https://discourse.julialang.org/t/how-to-plot-heat-maps-with-grid-lines-in-plots-jl-with-gr-as-backend/91996)._
