Makie recipe usage

I read about a post makie-recipe-specialisation-for-specific-types for plotting customized types from Makie. The official document also has a Plot-Recipes section, but I still do not understand how to use it. Additionally, there is a MakieRecipes repo which makes it more confusing to me.

Let me start with my first attempt, following the Type-recipes example in the document:

using Makie

struct MyType
   data::Vector
end

convert_arguments(P::Type{<:AbstractPlot}, x::MyType) = (rand(10),)

fig = Figure(resolution = (1200, 700), backgroundcolor = RGBf0(0.98, 0.98, 0.98))
ax1 = fig[1, 1] = Axis(fig, title = "test")

mydata = MyType(ones(10))
plot!(mydata)
fig

which displayed error

ERROR: LoadError: Plotting for the arguments (::MyType) not defined. If you want to support those arguments, overload plot!(plot::Plot(MyType,))

Hmm weird. Why do I need to overload the plotting functions if it is a recipe? Indeed adding

function AbstractPlotting.plot!(mydata::MyType)
   plot!(mydata.data)
end

works in this case, but that is different from what I expected.

I then realized from this reply to a similar post that I need to import AbstractPlotting, so my second attempt is


using Makie

struct MyType
   data::Vector
end

AbstractPlotting.convert_arguments(P::Type{<:AbstractPlot}, x::MyType) = (rand(10),)

fig = Figure(resolution = (1200, 700), backgroundcolor = RGBf0(0.98, 0.98, 0.98))
ax1 = fig[1, 1] = Axis(fig, title = "test")

mydata = MyType(ones(10))
plot!(mydata)
fig

It seemed like defining a convert_arguments which returns a tuple was all I needed. However, this also again complains:

ERROR: LoadError: MethodError: no method matching to_ndim(::Type{Vec{3,Float32}}, ::Float64, ::Int64)
Closest candidates are:
  to_ndim(::Type{var"#s81"} where var"#s81"<:Union{Tuple{Vararg{ET,N}}, StaticArrays.StaticArray{Tuple{N},ET,1}}, ::Union{Tuple{Vararg{T,N2}}, StaticArrays.StaticArray{Tuple{N2},T,1}} where T, ::Any) where {N, ET, N2} at /home/hongyang/.julia/packages/AbstractPlotting/ll2vf/src/utilities/utilities.jl:188

What am I missing here? Besides this, is the development for MakieRecipes a completely parallel effort?

@asinghvi17

you should be reading this
http://makie.juliaplots.org/stable/recipes.html

Isn’t it the same link I shared in the main post? That’s where I got confused.