# Draw surface with contours plot underneath

**URL:** <https://discourse.julialang.org/t/draw-surface-with-contours-plot-underneath/54813>\
**Category:** New to Julia\
**Tags:** plotting, visualization\
**Created:** [February 7, 2021, 8:27pm UTC](https://discourse.julialang.org/t/draw-surface-with-contours-plot-underneath/54813 "2021-02-07T20:27:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![angeloaliano1](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Post date:** [February 7, 2021, 8:27pm UTC](https://discourse.julialang.org/t/draw-surface-with-contours-plot-underneath/54813/1 "2021-02-07T20:27:22Z")

</div>

Hello,  
there is a way to draw a surface and the contours plot underneath, like the figure below?  
 ![grafico](https://global.discourse-cdn.com/julialang/original/3X/c/c/cc609d560afb7b46ebbc8ecb64cf73903707f1e5.png)

Below I present my code to adapt.

```julia
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)

```

---

<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:** [February 7, 2021, 11:18pm UTC](https://discourse.julialang.org/t/draw-surface-with-contours-plot-underneath/54813/2 "2021-02-07T23:18:50Z")

</div>

Check Makie’s gallery and the solution [here](http://juliaplots.org/MakieReferenceImages/gallery//surface ___wireframe___ contour/index.html).

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [February 8, 2021, 12:44am UTC](https://discourse.julialang.org/t/draw-surface-with-contours-plot-underneath/54813/3 "2021-02-08T00:44:18Z")

</div>

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

```julia
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)

```

 ![GMTjl_tmp](https://global.discourse-cdn.com/julialang/original/3X/0/6/062ccf7ba63e3dce40d37de65239cc500e1176e9.png)

---

<div class="post-metadata">

**Author:** ![mbaz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbaz/32/17295_2.png) [@mbaz](https://discourse.julialang.org/u/mbaz)\
**Post date:** [February 8, 2021, 1:43am UTC](https://discourse.julialang.org/t/draw-surface-with-contours-plot-underneath/54813/4 "2021-02-08T01:43:29Z")

</div>

With [Gaston](https://mbaz.github.io/Gaston.jl/stable/3d-gallery/#Surface-with-contours-1):

```julia
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))

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/9/9/99857b9b11ffe28cb3897a184826e195de289091.png)
