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

You can use vline! and hline!:

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.

1 Like