# What are the advantages of using @recipe in Plots vs import RecipesBase.plot?

**URL:** <https://discourse.julialang.org/t/what-are-the-advantages-of-using-recipe-in-plots-vs-import-recipesbase-plot/68366>\
**Category:** Visualization\
**Tags:** plots, recipe\
**Created:** [September 18, 2021, 10:06am UTC](https://discourse.julialang.org/t/what-are-the-advantages-of-using-recipe-in-plots-vs-import-recipesbase-plot/68366 "2021-09-18T10:06:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![viraltux](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/viraltux/32/15236_2.png) [@viraltux](https://discourse.julialang.org/u/viraltux)\
**Post date:** [September 18, 2021, 10:06am UTC](https://discourse.julialang.org/t/what-are-the-advantages-of-using-recipe-in-plots-vs-import-recipesbase-plot/68366/1 "2021-09-18T10:06:25Z")

</div>

@recipe is described in its docstring as

> This functionality is primarily geared to turning user types and settings into the data and  
> attributes that describe a Plots.jl visualization.

The example given to dispatch on type with its defaults is

```julia
 using RecipesBase
 type T end
 @recipe function plot{N<:Integer}(t::T, n::N = 1; customcolor = :green)
      markershape --> :auto, :require
      markercolor --> customcolor, :force
      xrotation --> 5
      zrotation --> 6, :quiet
      rand(10,n)
 end
 using Plots; gr()
 plot(T(), 5; customcolor = :black, shape=:c)

```

which seems it can be replicated without @recipe with:

```julia
using Plots
import RecipesBase.plot

struct T end
function plot(t::T,n::Integer=1,args...;customcolor = :green, kw...)
    x = rand(10,n)
    plot(x,args...;
         markercolor = customcolor,
         markershape = :auto,
         xrotation = 5, zrotation = 6,
         kw...)
end

plot(T(),5; customcolor = :black, shape = :c)

```

I wonder what would be the advantage(s) of using `@recipe` over `import RecipesBase.plot` to dispatch by type.
