slice defaults

This commit is contained in:
Simon Christ 2022-04-19 17:39:08 +02:00
parent 182d4683e6
commit fc569cda55
2 changed files with 9 additions and 3 deletions

View File

@ -1762,7 +1762,7 @@ function slice_arg!(
idx::Int,
remove_pair::Bool,
)
v = get(plotattributes_in, k, plotattributes_out[k])
v = get(plotattributes_in, k, default(k))
plotattributes_out[k] = if haskey(plotattributes_in, k) && !(k in _plot_args)
if typeof(v) <: AMat && !isempty(v)
slice_arg(v, idx)
@ -2128,9 +2128,11 @@ function _replace_linewidth(plotattributes::AKW)
end
function _slice_series_args!(plotattributes::AKW, plt::Plot, sp::Subplot, commandIndex::Int)
series_kw = merge(_series_defaults, plotattributes)
for k in keys(_series_defaults)
haskey(plotattributes, k) &&
slice_arg!(plotattributes, plotattributes, k, commandIndex, false)
# k == :label && @show series_kw[:label], k, commandIndex
slice_arg!(series_kw, plotattributes, k, commandIndex, false)
# k == :label && @show plotattributes[:label]
end
return plotattributes
end

View File

@ -17,6 +17,10 @@ Plots.__init__()
@test Plots._series_defaults[:fillrange] == 0
pl = plot(1:5)
@test pl[1][1][:fillrange] == 0
default(label = ["Line a" "Line b"])
pl = plot(1:10, rand(10,2))
@test pl[1][1][:label] == "Line a"
@test pl[1][2][:label] == "Line b"
default()
end