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)
|
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)
|
for k in keys(_subplot_defaults)
|
||||||
slice_arg!(plotattributes_in, sp.attr, k, subplot_index, remove_pair)
|
slice_arg!(plotattributes_in, sp.attr, k, subplot_index, remove_pair)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -289,6 +289,7 @@ end
|
|||||||
|
|
||||||
function _add_plot_title!(plt)
|
function _add_plot_title!(plt)
|
||||||
plot_title = plt[:plot_title]
|
plot_title = plt[:plot_title]
|
||||||
|
plot_titleindex = nothing
|
||||||
|
|
||||||
if plot_title != ""
|
if plot_title != ""
|
||||||
# make new subplot for plot title
|
# make new subplot for plot title
|
||||||
@ -319,7 +320,7 @@ function _add_plot_title!(plt)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return nothing
|
return plot_titleindex
|
||||||
end
|
end
|
||||||
|
|
||||||
## Series recipes
|
## Series recipes
|
||||||
|
|||||||
@ -163,11 +163,11 @@ function plot!(plt1::Plot, plt2::Plot, plts_tail::Plot...; kw...)
|
|||||||
cmdidx += 1
|
cmdidx += 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
_add_plot_title!(plt)
|
ttl_idx = _add_plot_title!(plt)
|
||||||
|
|
||||||
# first apply any args for the subplots
|
# first apply any args for the subplots
|
||||||
for (idx, sp) in enumerate(plt.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
|
end
|
||||||
|
|
||||||
# finish up
|
# finish up
|
||||||
|
|||||||
@ -37,19 +37,25 @@ end
|
|||||||
Plots.use_local_dependencies[] = temp
|
Plots.use_local_dependencies[] = temp
|
||||||
end
|
end
|
||||||
|
|
||||||
include("test_defaults.jl")
|
for fn in (
|
||||||
include("test_pipeline.jl")
|
"test_defaults.jl",
|
||||||
include("test_axes.jl")
|
"test_pipeline.jl",
|
||||||
include("test_layouts.jl")
|
"test_axes.jl",
|
||||||
include("test_contours.jl")
|
"test_layouts.jl",
|
||||||
include("test_axis_letter.jl")
|
"test_contours.jl",
|
||||||
include("test_components.jl")
|
"test_axis_letter.jl",
|
||||||
include("test_shorthands.jl")
|
"test_components.jl",
|
||||||
include("integration_dates.jl")
|
"test_shorthands.jl",
|
||||||
include("test_recipes.jl")
|
"integration_dates.jl",
|
||||||
include("test_hdf5plots.jl")
|
"test_recipes.jl",
|
||||||
include("test_pgfplotsx.jl")
|
"test_hdf5plots.jl",
|
||||||
include("test_plotly.jl")
|
"test_pgfplotsx.jl",
|
||||||
|
"test_plotly.jl",
|
||||||
|
)
|
||||||
|
@testset "$fn" begin
|
||||||
|
include(fn)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
reference_dir(args...) =
|
reference_dir(args...) =
|
||||||
joinpath(homedir(), ".julia", "dev", "PlotReferenceImages", args...)
|
joinpath(homedir(), ".julia", "dev", "PlotReferenceImages", args...)
|
||||||
|
|||||||
@ -25,3 +25,10 @@ end
|
|||||||
@test pl[:plot_title] == "My new title"
|
@test pl[:plot_title] == "My new title"
|
||||||
@test pl[:plot_titleindex] == 5
|
@test pl[:plot_titleindex] == 5
|
||||||
end
|
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