Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg committed Feb 7, 2022
1 parent 37c45fd commit b2166c9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/pipeline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ function _subplot_setup(plt::Plot, plotattributes::AKW, kw_list::Vector{KW})
sp_attrs[sp] = attr
end

_add_plot_title!(plt, plotattributes)
_add_plot_title!(plt)
# override subplot/axis args. `sp_attrs` take precendence
for (idx, sp) in enumerate(plt.subplots)
attr = if !haskey(plotattributes, :subplot) || plotattributes[:subplot] == idx
Expand All @@ -287,8 +287,9 @@ 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, plotattributes)
function _add_plot_title!(plt)
plot_title = plt[:plot_title]
plot_titleindex = nothing

if plot_title != ""
# make new subplot for plot title
Expand All @@ -308,9 +309,6 @@ function _add_plot_title!(plt, plotattributes)
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

Expand All @@ -322,7 +320,7 @@ function _add_plot_title!(plt, plotattributes)
end
end

return nothing
return plot_titleindex
end

## Series recipes
Expand Down
4 changes: 2 additions & 2 deletions src/plot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ function plot!(plt1::Plot, plt2::Plot, plts_tail::Plot...; kw...)
cmdidx += 1
end
end
_add_plot_title!(plt, plotattributes)
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
Expand Down

0 comments on commit b2166c9

Please sign in to comment.