Draw surface with contours plot underneath

Hello,
there is a way to draw a surface and the contours plot underneath, like the figure below?
grafico

Below I present my code to adapt.

using Plots
plotly()
plot(size=(600,600))
my_cg = cgrad([:blue,:red,:orange,:yellow]);
f(x,y) = x^2+y^2
xs = range(-5, stop=5, length=40)
ys = range(-5, stop=5, length=40)
surface(g[2],xs,ys,f,c=my_cg)

Check Makie’s gallery and the solution here.

2 Likes

This one needs to dig a bit deeper in the GMT manual, but

using GMT
G = GMT.peaks();
grdcontour(G, view=(200,30), frame=:none)
grdview!(G, zsize=8, frame=:autoXYZg, surftype=(surface=true, mesh=true), fmt=:png, show=true)

2 Likes

With Gaston:

using Gaston
x = y = -10:0.5:10
f1 = (x,y) -> cos.(x./2).*sin.(y./2)
surf(x, y, f1,
     lc = :turquoise,
     Axes(hidden3d = :on,
          contour = "base",
          cntrparam = "levels 10",
          key = :off))

2 Likes