Moving grid lines to foreground with contour

When using contourf, I’d like to move the grid lines to the foreground, but I can’t quite see how to do that. Thanks.

You could just use transparency with eg alpha=0.5

Example below using GMT:

using GMT
G = GMT.peaks(N=100)
zmin, zmax = floor(Int,minimum(G)), ceil(Int,maximum(G))
colorstep = 0.1; contstep = 1; annotstep = 2;
C = makecpt(T=(zmin,zmax,colorstep), cmap=:rainbow);
contourf(G, C, cont=contstep, annot=annotstep;
        frame=(axes=(:left_full, :bot_full),),
        xaxis=(grid=1, annot=1, ticks=:auto, label="X [km]"),
        yaxis=(grid=1, annot=1, ticks=:auto, label="Y [km]") )
colorbar!(pos=(paper=true,anchor=(13,1),size=(10,0.5), vertical=true),
        frame=(annot=1, ticks=1, xlabel="Elevation [m]"), fmt=:png, show=true)

2 Likes

I don’t know if that can be done with Plots (GR), but I have been using hline and vline to add lines to form a grid in top of the other plots.

Example: https://github.com/m3g/CKP/blob/master/disciplina/codes/lcells2.jl

1 Like