move replaceAliases! out of recipe processing
This commit is contained in:
parent
c684213106
commit
932d0da73d
@ -916,8 +916,8 @@ function _add_markershape(plotattributes::AKW)
|
||||
end
|
||||
|
||||
"Handle all preprocessing of args... break out colors/sizes/etc and replace aliases."
|
||||
function preprocessArgs!(plotattributes::AKW)
|
||||
replaceAliases!(plotattributes, _keyAliases)
|
||||
function preprocessArgs!(plotattributes::AKW, replace_aliases = true)
|
||||
replace_aliases && replaceAliases!(plotattributes, _keyAliases)
|
||||
|
||||
# clear all axis stuff
|
||||
# if haskey(plotattributes, :axis) && plotattributes[:axis] in (:none, nothing, false)
|
||||
|
||||
@ -96,7 +96,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.plotattributes
|
||||
preprocessArgs!(kw)
|
||||
preprocessArgs!(kw, false)
|
||||
_preprocess_userrecipe(kw)
|
||||
warnOnUnsupported_scales(plt.backend, kw)
|
||||
|
||||
@ -185,7 +185,7 @@ function _process_plotrecipe(plt::Plot, kw::AKW, kw_list::Vector{KW}, still_to_p
|
||||
st = kw[:seriestype] = get(_typeAliases, st, st)
|
||||
datalist = RecipesBase.apply_recipe(kw, Val{st}, plt)
|
||||
for data in datalist
|
||||
preprocessArgs!(data.plotattributes)
|
||||
preprocessArgs!(data.plotattributes, false)
|
||||
if data.plotattributes[:seriestype] == st
|
||||
error("Plot recipe $st returned the same seriestype: $(data.plotattributes)")
|
||||
end
|
||||
@ -413,7 +413,7 @@ function _process_seriesrecipe(plt::Plot, plotattributes::AKW)
|
||||
# assuming there was no error, recursively apply the series recipes
|
||||
for data in datalist
|
||||
if isa(data, RecipeData)
|
||||
preprocessArgs!(data.plotattributes)
|
||||
preprocessArgs!(data.plotattributes, false)
|
||||
if data.plotattributes[:seriestype] == st
|
||||
error("The seriestype didn't change in series recipe $st. This will cause a StackOverflow.")
|
||||
end
|
||||
|
||||
@ -227,7 +227,6 @@ _apply_type_recipe(plotattributes, v::AbstractArray{<:DataPoint}, letter) = v
|
||||
|
||||
# axis args before type recipes should still be mapped to all axes
|
||||
function _preprocess_axis_args!(plotattributes)
|
||||
replaceAliases!(plotattributes, _keyAliases)
|
||||
for (k, v) in plotattributes
|
||||
if haskey(_axis_defaults, k)
|
||||
pop!(plotattributes, k)
|
||||
@ -247,7 +246,6 @@ end
|
||||
function _postprocess_axis_args!(plotattributes, letter)
|
||||
pop!(plotattributes, :letter)
|
||||
if letter in (:x, :y, :z)
|
||||
replaceAliases!(plotattributes, _keyAliases)
|
||||
for (k, v) in plotattributes
|
||||
if haskey(_axis_defaults, k)
|
||||
pop!(plotattributes, k)
|
||||
|
||||
@ -26,8 +26,9 @@ struct Attr <: AbstractDict{Symbol,Any}
|
||||
defaults::KW
|
||||
end
|
||||
|
||||
Base.getindex(attr::Attr, k) = haskey(attr.explicit,k) ?
|
||||
attr.explicit[k] : attr.defaults[k]
|
||||
function Base.getindex(attr::Attr, k)
|
||||
return haskey(attr.explicit, k) ? attr.explicit[k] : attr.defaults[k]
|
||||
end
|
||||
Base.haskey(attr::Attr, k) = haskey(attr.explicit,k) || haskey(attr.defaults,k)
|
||||
Base.get(attr::Attr, k, default) = haskey(attr, k) ? attr[k] : default
|
||||
function Base.get!(attr::Attr, k, default)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user