Skip to content

Commit

Permalink
fix PlotSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch committed Jul 24, 2023
1 parent 64576ce commit ee5e570
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions MakieCore/src/recipes.jl
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions src/interfaces.jl
Expand Up @@ -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))
Expand All @@ -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}
Expand Down

0 comments on commit ee5e570

Please sign in to comment.