Fix plotattributes in _add_plot_title! (#4090)
Co-authored-by: Simon Christ <SimonChrist@gmx.de>
This commit is contained in:
parent
ce70ec26a6
commit
bf5d1aa060
@ -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
|
||||
|
||||
@ -289,6 +289,7 @@ end
|
||||
|
||||
function _add_plot_title!(plt)
|
||||
plot_title = plt[:plot_title]
|
||||
plot_titleindex = nothing
|
||||
|
||||
if plot_title != ""
|
||||
# make new subplot for plot title
|
||||
@ -319,7 +320,7 @@ function _add_plot_title!(plt)
|
||||
end
|
||||
end
|
||||
|
||||
return nothing
|
||||
return plot_titleindex
|
||||
end
|
||||
|
||||
## Series recipes
|
||||
|
||||
@ -163,11 +163,11 @@ function plot!(plt1::Plot, plt2::Plot, plts_tail::Plot...; kw...)
|
||||
cmdidx += 1
|
||||
end
|
||||
end
|
||||
_add_plot_title!(plt)
|
||||
ttl_idx = _add_plot_title!(plt)
|
||||
|
||||
# first apply any args for the subplots
|
||||
for (idx, sp) in enumerate(plt.subplots)
|
||||
_update_subplot_args(plt, sp, plotattributes, idx, false)
|
||||
_update_subplot_args(plt, sp, idx == ttl_idx ? KW() : plotattributes, idx, false)
|
||||
end
|
||||
|
||||
# finish up
|
||||
|
||||
@ -37,19 +37,25 @@ end
|
||||
Plots.use_local_dependencies[] = temp
|
||||
end
|
||||
|
||||
include("test_defaults.jl")
|
||||
include("test_pipeline.jl")
|
||||
include("test_axes.jl")
|
||||
include("test_layouts.jl")
|
||||
include("test_contours.jl")
|
||||
include("test_axis_letter.jl")
|
||||
include("test_components.jl")
|
||||
include("test_shorthands.jl")
|
||||
include("integration_dates.jl")
|
||||
include("test_recipes.jl")
|
||||
include("test_hdf5plots.jl")
|
||||
include("test_pgfplotsx.jl")
|
||||
include("test_plotly.jl")
|
||||
for fn in (
|
||||
"test_defaults.jl",
|
||||
"test_pipeline.jl",
|
||||
"test_axes.jl",
|
||||
"test_layouts.jl",
|
||||
"test_contours.jl",
|
||||
"test_axis_letter.jl",
|
||||
"test_components.jl",
|
||||
"test_shorthands.jl",
|
||||
"integration_dates.jl",
|
||||
"test_recipes.jl",
|
||||
"test_hdf5plots.jl",
|
||||
"test_pgfplotsx.jl",
|
||||
"test_plotly.jl",
|
||||
)
|
||||
@testset "$fn" begin
|
||||
include(fn)
|
||||
end
|
||||
end
|
||||
|
||||
reference_dir(args...) =
|
||||
joinpath(homedir(), ".julia", "dev", "PlotReferenceImages", args...)
|
||||
|
||||
@ -25,3 +25,10 @@ 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[1][:framestyle] === :grid
|
||||
@test p[2][:framestyle] === :grid
|
||||
@test p[3][:framestyle] === :none
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user