diff --git a/src/args.jl b/src/args.jl index 2afec51ff..be0a9254a 100644 --- a/src/args.jl +++ b/src/args.jl @@ -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 diff --git a/test/test_defaults.jl b/test/test_defaults.jl index a95f59406..4c42dade9 100644 --- a/test/test_defaults.jl +++ b/test/test_defaults.jl @@ -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