recipe postprocessing for aliases and magic args
This commit is contained in:
parent
333714911c
commit
011f51fbd9
@ -688,7 +688,7 @@ function preprocessArgs!(d::KW)
|
||||
a = d[:arrow]
|
||||
d[:arrow] = if a == true
|
||||
arrow()
|
||||
elseif a == false
|
||||
elseif a in (false, nothing, :none)
|
||||
nothing
|
||||
elseif !(typeof(a) <: Arrow)
|
||||
arrow(wraptuple(a)...)
|
||||
@ -698,9 +698,9 @@ function preprocessArgs!(d::KW)
|
||||
end
|
||||
|
||||
|
||||
if get(d, :arrow, false) == true
|
||||
d[:arrow] = arrow()
|
||||
end
|
||||
# if get(d, :arrow, false) == true
|
||||
# d[:arrow] = arrow()
|
||||
# end
|
||||
|
||||
# legends
|
||||
if haskey(d, :legend)
|
||||
|
||||
@ -95,6 +95,7 @@ function _process_userrecipe(plt::Plot, kw_list::Vector{KW}, recipedata::RecipeD
|
||||
# when the arg tuple is empty, that means there's nothing left to recursively
|
||||
# process... finish up and add to the kw_list
|
||||
kw = recipedata.d
|
||||
preprocessArgs!(kw)
|
||||
_preprocess_userrecipe(kw)
|
||||
warnOnUnsupported_scales(plt.backend, kw)
|
||||
|
||||
@ -183,6 +184,7 @@ function _process_plotrecipe(plt::Plot, kw::KW, kw_list::Vector{KW}, still_to_pr
|
||||
st = kw[:seriestype] = get(_typeAliases, st, st)
|
||||
datalist = RecipesBase.apply_recipe(kw, Val{st}, plt)
|
||||
for data in datalist
|
||||
preprocessArgs!(data.d)
|
||||
if data.d[:seriestype] == st
|
||||
error("Plot recipe $st returned the same seriestype: $(data.d)")
|
||||
end
|
||||
@ -389,6 +391,10 @@ function _process_seriesrecipe(plt::Plot, d::KW)
|
||||
# assuming there was no error, recursively apply the series recipes
|
||||
for data in datalist
|
||||
if isa(data, RecipeData)
|
||||
preprocessArgs!(data.d)
|
||||
if data.d[:seriestype] == st
|
||||
error("The seriestype didn't change in series recipe $st. This will cause a StackOverflow.")
|
||||
end
|
||||
_process_seriesrecipe(plt, data.d)
|
||||
else
|
||||
warn("Unhandled recipe: $(data)")
|
||||
|
||||
@ -85,6 +85,44 @@ facts("Axes") do
|
||||
end
|
||||
|
||||
|
||||
# tests for preprocessing recipes
|
||||
|
||||
# facts("recipes") do
|
||||
|
||||
# user recipe
|
||||
|
||||
# type T end
|
||||
# @recipe function f(::T)
|
||||
# line := (3,0.3,:red)
|
||||
# marker := (20,0.5,:blue,:o)
|
||||
# bg := :yellow
|
||||
# rand(10)
|
||||
# end
|
||||
# plot(T())
|
||||
|
||||
# plot recipe
|
||||
|
||||
# @recipe function f(::Type{Val{:hiplt}},plt::Plot)
|
||||
# line := (3,0.3,:red)
|
||||
# marker := (20,0.5,:blue,:o)
|
||||
# t := :path
|
||||
# bg:=:green
|
||||
# ()
|
||||
# end
|
||||
# plot(rand(10),t=:hiplt)
|
||||
|
||||
# series recipe
|
||||
|
||||
# @recipe function f(::Type{Val{:hi}},x,y,z)
|
||||
# line := (3,0.3,:red)
|
||||
# marker := (20,0.5,:blue,:o)
|
||||
# t := :path
|
||||
# ()
|
||||
# end
|
||||
# plot(rand(10),t=:hiplt)
|
||||
|
||||
# end
|
||||
|
||||
|
||||
|
||||
FactCheck.exitstatus()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user