This commit is contained in:
t-bltg 2022-02-07 20:11:51 +01:00
parent 37c45fd3ee
commit 5d89cc1385
3 changed files with 25 additions and 21 deletions

View File

@ -266,7 +266,7 @@ function _subplot_setup(plt::Plot, plotattributes::AKW, kw_list::Vector{KW})
sp_attrs[sp] = attr sp_attrs[sp] = attr
end end
_add_plot_title!(plt, plotattributes) _add_plot_title!(plt)
# override subplot/axis args. `sp_attrs` take precendence # override subplot/axis args. `sp_attrs` take precendence
for (idx, sp) in enumerate(plt.subplots) for (idx, sp) in enumerate(plt.subplots)
attr = if !haskey(plotattributes, :subplot) || plotattributes[:subplot] == idx attr = if !haskey(plotattributes, :subplot) || plotattributes[:subplot] == idx
@ -287,8 +287,9 @@ function series_idx(kw_list::AVec{KW}, kw::AKW)
Int(kw[:series_plotindex]) - Int(kw_list[1][:series_plotindex]) + 1 Int(kw[:series_plotindex]) - Int(kw_list[1][:series_plotindex]) + 1
end end
function _add_plot_title!(plt, plotattributes) 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
@ -308,9 +309,6 @@ function _add_plot_title!(plt, plotattributes)
plt[:plot_titleindex] = subplot[:subplot_index] plt[:plot_titleindex] = subplot[:subplot_index]
subplot[:framestyle] = :none subplot[:framestyle] = :none
subplot[:margin] = 0px subplot[:margin] = 0px
# prevents propagation (see JuliaPlots/Plots.jl/issues/4083)
pop!(plotattributes, :framestyle, nothing)
pop!(plotattributes, :margin, nothing)
push!(plt.subplots, subplot) push!(plt.subplots, subplot)
end end
@ -322,7 +320,7 @@ function _add_plot_title!(plt, plotattributes)
end end
end end
return nothing return plot_titleindex
end end
## Series recipes ## Series recipes

View File

@ -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, plotattributes) 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

View File

@ -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...)