From ee5e570167265825912cf81ac4e73c7058b35b42 Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Mon, 24 Jul 2023 18:14:55 +0200 Subject: [PATCH] fix PlotSpec --- MakieCore/src/recipes.jl | 6 ++++-- src/interfaces.jl | 8 ++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/MakieCore/src/recipes.jl b/MakieCore/src/recipes.jl index 640bb0a872e..db92b981e05 100644 --- a/MakieCore/src/recipes.jl +++ b/MakieCore/src/recipes.jl @@ -23,13 +23,15 @@ plotkey(::T) where T <: AbstractPlot = plotkey(T) plotkey(::Nothing) = :scatter +argtypes(F, tuple::T) where {T <: Tuple} = (F, T) + function create_plot(P::Type{<: Combined{F}}, args, kw) where F if first(args) isa Attributes merge!(kw, attributes(popfirst!(args))) end args_converted = convert_arguments(P, map(to_value, args)...) - ArgTypes = Tuple{typeof.(args_converted)...} - return Combined{F,ArgTypes}(kw, args) + f_argtypes = argtypes(F, args_converted) + return Combined{f_argtypes...}(kw, args) end function create_plot(P::Type{<:Any}, args, kw) diff --git a/src/interfaces.jl b/src/interfaces.jl index 27a6b863392..ebdb636b7da 100644 --- a/src/interfaces.jl +++ b/src/interfaces.jl @@ -243,6 +243,9 @@ end function prepare_plot!(scene::SceneLike, plot::Combined{F}) where {F} plot.parent = scene + # TODO, move transformation into attributes? + # This hacks around transformation being already constructed in the constructor + # So here we don't want to connect to the scene if an explicit Transformation was passed to the plot t = to_value(getfield(plot, :kw)[:transformation]) if t isa Automatic connect!(transformation(scene), transformation(plot)) @@ -254,6 +257,11 @@ function prepare_plot!(scene::SceneLike, plot::Combined{F}) where {F} return plot end +function MakieCore.argtypes(F, plot::PlotSpec{P}) where {P} + args_converted = convert_arguments(P, plot.args...) + return MakieCore.argtypes(plotfunc(P), args_converted) +end + function convert_arguments!(plot::Combined{F}) where F P = Combined{F, Any}