Documenting a plot recipe

If you make a “user plot” recipe, e.g.

@userplot MyPlot
@recipe function plot_recipe(mp::MyPlot)
    ...
end

then you can document the generated functions myplot and myplot! with something like

@doc raw"""
    myplot(t_end)
    myplot!(t_end)

Documentation here
"""
myplot
@doc (@doc myplot) myplot!

I have done this in my own package, and Documenter handles this just fine.

But my intuition is that part of the magic of RecipesBase is that Plots.plot doesn’t get defined within your package, which is a good thing, so generating documentation for plot(res::SimResults) is much more complicated, or maybe impossible.

Also note that, per the documentation of RecipesBase, the function name in your recipe (so plot_recipe in my above example) gets thrown away so don’t expect to document that:

The function name f in is irrelevant and can be replaced by any other function name. @recipe does not use it.

1 Like