Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom type recipe doesn't work on Vector{Custom}, as plottype defaults to Scatter #4644

Open
evetion opened this issue Dec 4, 2024 · 1 comment

Comments

@evetion
Copy link

evetion commented Dec 4, 2024

struct Foo
end

function Makie.plot!(plot::Makie.Plot(Foo))
    error("Foo")
end

function Makie.plot!(plot::Makie.Plot{Makie.plot, <:Tuple{Vector{Foo}}})
    error("Foos")
end

foo = Foo()
foos = [foo]

plot(foo)  # error("Foo") ✅ 
plot(foos)  # Conversion failed for Scatter 🔴 

typeof(convert_arguments(Makie.Plot{plot}, [foo])) <: Tuple{Vector{Foo}}  # true

The workaround is to define Makie.plottype(::Vector{Foo}) = Plot{plot}.

@evetion evetion added the bug label Dec 4, 2024
@asinghvi17
Copy link
Member

asinghvi17 commented Dec 4, 2024

Ah, yeah I guess this is working as intended. plot is not actually a plot type. The way it's defined right now is Plot{PlotFunc, ArgTypeTuple} IIRC, and unlike in Plots, plot is not a recipe but rather a convenient function name. Scatter on the other hand is a plot recipe (and a default plot type) so its type is Plot{Makie.scatter, ArgTypeTuple}.

So you would always have to define plottype.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants