Skip to content

Docs examples of more recipes? #5160

@Ickaser

Description

@Ickaser

I know that at various times and in various channels, people have said that recipes are confusing. I have been in that camp, for sure. Some of the advice has been to look at real-world examples of recipes (e.g. https://discourse.julialang.org/t/are-recipes-still-an-advanced-topic/124217), and there are other cool tricks that aren't obvious https://discourse.julialang.org/t/calling-multiple-user-plot-recipes-from-single-recipe/122885/3?u=ickaser

So, my question here is: what would be a good place in the docs for this? Could there be a list of links to examples of recipes? Perhaps just another page of docs with more examples?

Here's an MWE I found very enlightening that I might consider adding to such a list of examples:

@userplot APlot
@recipe function f(a::APlot; asize=10)
    ax, ay = a.args
    @series begin
        linewidth --> asize
        ax, ay
    end
end

@userplot BPlot
@recipe function f(b::BPlot; bcolor=:purple)
    bx, by = b.args
    @series begin
        seriescolor --> bcolor
        bx, by
    end
end

@userplot ABPlot
@recipe function f(ab::ABPlot)
    ax, ay, bx, by = ab.args
    @series begin
        asize --> 20
        APlot((ax, ay))
    end
    @series begin
        bcolor --> :red
        BPlot((bx, by))
    end
end


abplot(1:3, rand(3), 1:3, rand(3))
abplot(1:3, rand(3), 1:3, rand(3), asize=3, bcolor=1)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions