diff --git a/src/pipeline.jl b/src/pipeline.jl index 94fce068..63bed9ef 100644 --- a/src/pipeline.jl +++ b/src/pipeline.jl @@ -262,6 +262,7 @@ function _subplot_setup(plt::Plot, plotattributes::AKW, kw_list::Vector{KW}) sp_attrs[sp] = attr end + _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 @@ -274,12 +275,29 @@ function _subplot_setup(plt::Plot, plotattributes::AKW, kw_list::Vector{KW}) # do we need to link any axes together? link_axes!(plt.layout, plt[:link]) + return nothing end 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) + plot_title = plt[:plot_title] + if plot_title != "" + the_layout = plt.layout + plt.layout = grid(2,1, heights = [0.0,1.0]) + plt.layout.grid[2,1] = the_layout + subplot = Subplot(backend(), parent = plt.layout[1,1]) + subplot.plt = plt + subplot[:title] = plot_title + subplot[:subplot_index] = last(plt.subplots)[:subplot_index] + 1 + subplot[:framestyle] = :none + plt.layout.grid[1,1] = subplot + push!(plt.subplots, subplot) + end + return nothing +end ## Series recipes