Adding arbitrary text to Plots.jl output

I’d like to add some footer text to my plots (I’m already using two lines of title), but can’t seem to find a way to do it. I know about annotate!(), but that only adds text within the plot region in the plot coordinate system, while I’d like to add text at arbitrary pixel locations in the output image. Is there any support for this in Plots.jl? Alternatively, is there a way to get the image pixels of a plot directly, without having to save first?

So indeed I can place annotations in the plot margin. But it’s still a bit tricky to get good label positioning, as the area containing axis ticks and labels needs to be skipped and I haven’t found a way to get their width/height yet.

For better control of the area dedicated to your bottom labels, you can use Plots.jl layouts.

Thanks for the tip! After a bit of fiddling I’m quite happy with this result:

using Plots
data = rand(4, 50)

l = @layout [a{0.98h} ; b]
p = heatmap(data, title="Title\nsubtitle", margin=1Plots.cm, yflip=true)

p2 = plot(axis=([], false), margin=0Plots.cm)
ftr = text("My footer containing blabla...", :black, :right, 8)
annotate!(1, 0.5, ftr)

plot(p, p2, layout=l, size=(960,540))