Skip to content

Unable to pass attributes if re-directed by recipe #3904

@Moelf

Description

@Moelf

Building on top of the examples: https://docs.makie.org/dev/tutorials/wrap-existing-recipe

The tutorial has this snippet:

function Makie.plot!(plot::Hist{<:Tuple{<:MyHist}})
    # Only forward valid attributes for BarPlot
    valid_attributes = Makie.shared_attributes(plot, BarPlot)
    barplot!(plot, valid_attributes, plot[1])
end

h = MyHist([1, 10, 100], 1:3)
hist(h; color=:red, direction=:x)

Now, let's say user wants to also customize Makie.hist(myhist; clamp_bincounts = ...), they can't get this to work.

In particular, it is not enough to register these:

Makie.used_attributes(::Type{<:Hist}, h::MyHist) = (:clamp_bincounts, )
Makie.used_attributes(::Type{<:BarPlot}, h::MyHist) = (:clamp_bincounts, )

because by the time we're inside our own function Makie.plot!(plot::Hist{<:Tuple{<:MyHist}}) method, the attributes no longer contain the keyword argument we need.

@asinghvi17

Metadata

Metadata

Assignees

No one assigned

    Labels

    MakieBackend independent issues (Makie core)bugconversionsMainly `convert_arguments`recipes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions