How to make top title in group layout plot?

Hello!

I have this plot:

How would I make a title above both of them called “My Plot”?

These are the basic commands I use:

l = @layout grid(2,1)

pall = plot(p1,p2, layout = l,size=(800,800))

If I try using the “title” option in “pall” it changes both of them.

Kind regards

You’re basically asking for the existing but not yet functional attribute plot_title (see: Plot Attributes · Plots ). It’s mentioned in the docs. And there are a few open issues about this topic on github.

A hacky way of doing it was in this thread

title = plot(title = "Plot title", grid = false, showaxis = false, bottom_margin = -25Plots.px)
p1 = scatter(rand(5, 1), title = "Subplot 1")
p2 = scatter(rand(5, 1), title = "Subplot 2")
plot(title, p1, p2, layout = @layout([A{0.01h}; [B C]]))

image

1 Like