# Series recipe for a 3d plot or a heatmap

**URL:** <https://discourse.julialang.org/t/series-recipe-for-a-3d-plot-or-a-heatmap/27614>\
**Category:** Visualization\
**Tags:** plots, recipe\
**Created:** [August 16, 2019, 12:43pm UTC](https://discourse.julialang.org/t/series-recipe-for-a-3d-plot-or-a-heatmap/27614 "2019-08-16T12:43:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![misha\_mikhasenko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/misha_mikhasenko/32/5060_2.png) [@misha\_mikhasenko](https://discourse.julialang.org/u/misha_mikhasenko)\
**Post date:** [August 16, 2019, 12:43pm UTC](https://discourse.julialang.org/t/series-recipe-for-a-3d-plot-or-a-heatmap/27614/1 "2019-08-16T12:43:10Z")

</div>

I am trying to make a recipe for a customized `heatmap`. However, my new `seriestype` is not recognized as 3d, is it seems.

```julia
@recipe function f(::Type{Val{:balanceplot}}, x, y, z)
    zlim = max(abs.(z)...)
    clim := (-zlim,zlim)
    seriestype := :heatmap
    c := :balance
    ()
end

```

```julia
plot(1:10,1:10,rand(10,10), t=:balanceplot) # produces contour plot
plot(rand(10,10), t=:balanceplot) # treats matrix as 10 rows of vectors

```

Any suggestions?

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [August 19, 2019, 12:43pm UTC](https://discourse.julialang.org/t/series-recipe-for-a-3d-plot-or-a-heatmap/27614/2 "2019-08-19T12:43:49Z")

</div>

Try returning `x`, `y` and `z` explicitly.

---

<div class="post-metadata">

**Author:** ![misha\_mikhasenko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/misha_mikhasenko/32/5060_2.png) [@misha\_mikhasenko](https://discourse.julialang.org/u/misha_mikhasenko)\
**Post date:** [August 22, 2019, 9:14pm UTC](https://discourse.julialang.org/t/series-recipe-for-a-3d-plot-or-a-heatmap/27614/3 "2019-08-22T21:14:53Z")

</div>

Thanks for the answer, however, it does not seem to work,

```julia
using Plots
@recipe function f(::Type{Val{:balanceplot}}, x, y, z)
    zlim = max(abs.(z)...)
    clim := (-zlim,zlim)
    seriestype := :heatmap
    c := :balance
    return (x,y,z)
end

plot(1:10, 1:10, rand(10,10), t=:balanceplot)
# still produces a contour plot

```
