Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/args.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/test_defaults.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
pl = plot(1:10, rand(10,2))
pl = plot(1:10, rand(10, 2))

@test pl[1][1][:label] == "Line a"
@test pl[1][2][:label] == "Line b"
default()
end

Expand Down