# Plot recipe that performs multiple plot calls

**URL:** <https://discourse.julialang.org/t/plot-recipe-that-performs-multiple-plot-calls/114944>\
**Category:** General Usage\
**Tags:** question, recipe, plot\
**Created:** [May 29, 2024, 10:21pm UTC](https://discourse.julialang.org/t/plot-recipe-that-performs-multiple-plot-calls/114944 "2024-05-29T22:21:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirklong](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirklong/32/19433_2.png) [@kirklong](https://discourse.julialang.org/u/kirklong)\
**Post date:** [May 29, 2024, 10:21pm UTC](https://discourse.julialang.org/t/plot-recipe-that-performs-multiple-plot-calls/114944/1 "2024-05-29T22:21:26Z")

</div>

I am trying to define a recipe for a custom type. I have gotten a basic thing to work using the @userplot macro and following some examples, but I want to extend this to allow the recipe to do what would be multiple plot calls. Here is a simple MWE:

```julia
@userplot Custom3d
@recipe function f(p::Custom3d)
  x,y,z = p.args
  seriestype := :scatter
  x := vec(x
  y := y
  z := z
  ()
end

```

then doing `custom3d(rand(3),rand(3),rand(3))` produces (for example):  
 ![q](https://global.discourse-cdn.com/julialang/original/3X/1/b/1b411a9e6c7c79c8441cedf1a3c903e69e365ce6.png)

What I want to do next is draw a shape on one of the “walls” of the box, i.e. a square with sides defined by the maximum value in x drawn on the +xz wall. With normal plot commands I could just do something like `p = plot!([-maximum(x),-maximum(x),maximum(x),maximum(x)],[ylims(p)[2],ylims(p)[2],ylims(p)[2],ylims(p)[2]],[-maximum(x),maximum(x),maximum(x),-maximum(x)],fill=true)`, but I’m not sure how to accomplish the same thing within the @recipe macro?

I tried defining two series (placing the scatter commands inside one @series block and the shape commands inside a second) but that didn’t work. Any help appreciated!

---

<div class="post-metadata">

**Author:** ![kirklong](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kirklong/32/19433_2.png) [@kirklong](https://discourse.julialang.org/u/kirklong)\
**Post date:** [May 30, 2024, 5:44pm UTC](https://discourse.julialang.org/t/plot-recipe-that-performs-multiple-plot-calls/114944/2 "2024-05-30T17:44:38Z")

</div>

I was missing putting a `()` at the bottom of each `@series` block. It works if you do that.
