Skip to content

Custom recipes arguments converted aggressively #300

@MichaelHatherly

Description

@MichaelHatherly

Given the below recipe Makie will dispatch to the right method when given input x of type CategoricalVector to myrecipe(x, y).

using CairoMakie, AlgebraOfGraphics, CategoricalArrays

@recipe(MyRecipe, x, y) do _
	Attributes()
end

function Makie.plot!(p::MyRecipe)
	Makie.@extract p (x, y)
	scatter!(p, x, y)
	return p
end

function Makie.plot!(p::MyRecipe{<:Tuple{<:CategoricalVector,Any}})
	Makie.@extract p (x, y)
	map(x, y) do x, y
		violin!(p, levelcode.(x), y)
	end
	return p
end

But when used as visual(MyRecipe) the x is of type Vector{Int} regardless of the input types. The inputs seem to always be reduced to barest possible representation.

Is this considered expected behaviour, or a fixable issue?

AoG version v0.5.4 and CairoMakie version v0.6.6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions