diff --git a/src/args.jl b/src/args.jl index 75923436..e7224121 100644 --- a/src/args.jl +++ b/src/args.jl @@ -2059,7 +2059,7 @@ function _update_subplot_args( ) anns = RecipesPipeline.pop_kw!(sp.attr, :annotations) - # # grab those args which apply to this subplot + # grab those args which apply to this subplot for k in keys(_subplot_defaults) slice_arg!(plotattributes_in, sp.attr, k, subplot_index, remove_pair) end diff --git a/src/pipeline.jl b/src/pipeline.jl index 7808f7b6..46c8c7f5 100644 --- a/src/pipeline.jl +++ b/src/pipeline.jl @@ -266,7 +266,7 @@ function _subplot_setup(plt::Plot, plotattributes::AKW, kw_list::Vector{KW}) sp_attrs[sp] = attr end - _add_plot_title!(plt) + _add_plot_title!(plt, plotattributes) # override subplot/axis args. `sp_attrs` take precendence for (idx, sp) in enumerate(plt.subplots) attr = if !haskey(plotattributes, :subplot) || plotattributes[:subplot] == idx @@ -287,7 +287,7 @@ function series_idx(kw_list::AVec{KW}, kw::AKW) Int(kw[:series_plotindex]) - Int(kw_list[1][:series_plotindex]) + 1 end -function _add_plot_title!(plt) +function _add_plot_title!(plt, plotattributes) plot_title = plt[:plot_title] if plot_title != "" @@ -308,6 +308,9 @@ function _add_plot_title!(plt) plt[:plot_titleindex] = subplot[:subplot_index] subplot[:framestyle] = :none subplot[:margin] = 0px + # prevents propagation (see JuliaPlots/Plots.jl/issues/4083) + pop!(plotattributes, :framestyle, nothing) + pop!(plotattributes, :margin, nothing) push!(plt.subplots, subplot) end diff --git a/src/plot.jl b/src/plot.jl index ba689a0b..e527e54c 100644 --- a/src/plot.jl +++ b/src/plot.jl @@ -163,7 +163,7 @@ function plot!(plt1::Plot, plt2::Plot, plts_tail::Plot...; kw...) cmdidx += 1 end end - _add_plot_title!(plt) + _add_plot_title!(plt, plotattributes) # first apply any args for the subplots for (idx, sp) in enumerate(plt.subplots) diff --git a/test/test_layouts.jl b/test/test_layouts.jl index 41ce0bdf..42a3b02c 100644 --- a/test/test_layouts.jl +++ b/test/test_layouts.jl @@ -25,3 +25,8 @@ end @test pl[:plot_title] == "My new title" @test pl[:plot_titleindex] == 5 end + +@testset "Plots.jl/issues/4083" begin + p = plot(plot(1:2), plot(1:2); border = :grid, plot_title = "abc") + @test p.subplots[end][:framestyle] === :none +end