Dispatch with @userplot and external recipes

OK, so I’ve solved this myself I think.

Part 1: rather than use @userplot I just made the functions that would have been generated by the macro manually, but made them dispatchable:

mutable struct PlotCustom{AbstractType}
    args::Any                                      
end
    
plotcustom(args...; kw...) = RecipesBase.plot(PlotCustom{typeof(args[1].count)}(args); kw...)
#etc

Part 2: So long as I’m using GraphRecipes, I can omit assigning a value to seriestype, and leave the last line of my recipe as an <: AbstractGraph. Then the graph recipe will take over from there.

If anyone has a cleaner way of doing this I’d be interested to know!

3 Likes