Makie: add title to plot

#1

How to add a title to a Makie plot? I would to produce a plot like the following using Makie instead of Plots.jl:

julia> using Plots; plot(randn(10), title="my random numbers")

grafik

0 Likes

#2

This will need some better integration, but this works:

using Makie

theplot = lines(randn(10))

pos = lift(pixelarea(theplot)) do area
    x = widths(area)[1] ./ 2
    Vec2f0(x, 10) # offset 10px, to give it some space
end
title = text(
    "my random numbers", align = (:center, :bottom), 
    position = pos, camera = campixel!, raw = true, textsize = 40, # in pixel,
)
hbox(theplot, title)


Could probably be put in a title function…

2 Likes