I am just wondering how to add captions to figures in Makie, as highlighted in the following picture in red? I tried annotations() and text() but the effect are not satisfactory. Maybe I used them in a wrong way. Anyone may help me out? Thanks!
How could we do that using text!() ? I wrote the following code under Julia 1.7.0 and
CairoMakie 0.6.6οΌthe text is always in the plotting area.
using CairoMakie
CairoMakie.activate!()
function text_as_caption()
lines(1:0.1:10, sin.(1:0.1:10))
text!("This is caption.", position = (0, -10))
current_figure()
end
text_as_caption()
if I want the caption to be left-aligned, how could I do that? I tried in the following code under Julia 1.7.0 and CairoMakie 0.6.6, but the result is weird.
using CairoMakie
CairoMakie.activate!()
function text_as_caption()
fig = Figure(resolution = (600, 600))
lines(fig[1,1],1:0.1:10, sin.(1:0.1:10))
Label(fig[2,1, TopLeft()], "This is a caption.",
tellheight = true)
current_figure()
end
text_as_caption()
f = Figure(resolution=(300, 200))
scatter(f[1,1], rand(5))
Label(f[2,1], "ππΆπ΄ππΏπ² π Some data.", tellwidth=false, halign=:left)
f
If you want the text aligned with the left of the y tick labels, I donβt know how to do that but maybe @jules has an idea you can use alignmode as described in the manual:
f = Figure(resolution=(300, 200))
scatter(f[1,1], rand(5), axis=(; alignmode=Outside()))
Label(f[2,1], "ππΆπ΄ππΏπ² π Random data.", tellwidth=false, halign=:left)
f
(Iβm starting to think that Makieβs layouting capabilities are really awesome.)