From e70c30dd13db7d03ef8a3ab2040c842215d1268f Mon Sep 17 00:00:00 2001 From: Giorgio Calderone Date: Sun, 5 Dec 2021 15:59:48 +0100 Subject: [PATCH] Handle the case where an implicit recipe returns a Vector{PlotElement} --- src/Gnuplot.jl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Gnuplot.jl b/src/Gnuplot.jl index 18a8057..026ae15 100644 --- a/src/Gnuplot.jl +++ b/src/Gnuplot.jl @@ -1125,7 +1125,16 @@ function parseArguments(_args...) elseif hasmethod(recipe, tuple(typeof(arg))) # ==> implicit recipe # @info which(recipe, tuple(typeof(arg))) # debug deleteat!(args, pos) - insert!(args, pos, recipe(arg)) + pe = recipe(arg) + if isa(pe, PlotElement) + insert!(args, pos, pe) + elseif isa(pe, Vector{PlotElement}) + for i in 1:length(pe) + insert!(args, pos, pe[i]) + end + else + error("Recipe must return a PlotElement or Vector{PlotElement}") + end continue elseif isa(arg, Vector{PlotElement}) # ==> explicit recipe (vector) deleteat!(args, pos)