fix magic axis args for recipes

This commit is contained in:
Daniel Schwabeneder 2020-03-27 17:09:07 +01:00
parent 8594926b67
commit e9ef5c852b
2 changed files with 10 additions and 5 deletions

View File

@ -466,12 +466,17 @@ const _magic_axis_args = [:axis, :tickfont, :guidefont]
const _magic_subplot_args = [:titlefont, :legendfont, :legendtitlefont, ] const _magic_subplot_args = [:titlefont, :legendfont, :legendtitlefont, ]
const _magic_series_args = [:line, :marker, :fill] const _magic_series_args = [:line, :marker, :fill]
function is_default_attribute(k::Symbol) function is_noletter_attribute(k)
is_axis_attr_noletter(k) && return true
k in _magic_axis_args && return true
return false
end
function is_default_attribute(k)
k in _internal_args && return true k in _internal_args && return true
k in _all_args && return true k in _all_args && return true
is_axis_attr(k) && return true is_axis_attr(k) && return true
is_axis_attr_noletter(k) && return true is_noletter_attribute(k) && return true
k in _magic_axis_args && return true
k in _magic_subplot_args && return true k in _magic_subplot_args && return true
k in _magic_series_args && return true k in _magic_series_args && return true
Symbol(chop(string(k); head = 1, tail = 0)) in _magic_axis_args && return true Symbol(chop(string(k); head = 1, tail = 0)) in _magic_axis_args && return true

View File

@ -231,7 +231,7 @@ _apply_type_recipe(plotattributes, v::AbstractArray{<:DataPoint}, letter) = v
# axis args before type recipes should still be mapped to all axes # axis args before type recipes should still be mapped to all axes
function _preprocess_axis_args!(plotattributes) function _preprocess_axis_args!(plotattributes)
for (k, v) in plotattributes for (k, v) in plotattributes
if haskey(_axis_defaults, k) if is_noletter_attribute(k)
pop!(plotattributes, k) pop!(plotattributes, k)
for l in (:x, :y, :z) for l in (:x, :y, :z)
lk = Symbol(l, k) lk = Symbol(l, k)
@ -250,7 +250,7 @@ function _postprocess_axis_args!(plotattributes, letter)
pop!(plotattributes, :letter) pop!(plotattributes, :letter)
if letter in (:x, :y, :z) if letter in (:x, :y, :z)
for (k, v) in plotattributes for (k, v) in plotattributes
if haskey(_axis_defaults, k) if is_noletter_attribute(k)
pop!(plotattributes, k) pop!(plotattributes, k)
lk = Symbol(letter, k) lk = Symbol(letter, k)
haskey(plotattributes, lk) || (plotattributes[lk] = v) haskey(plotattributes, lk) || (plotattributes[lk] = v)