Annotations in Makie.jl

Is it currently possible to annotate Makie-plots? I am thinking about having text at the root of an arrow that point to some location in the plot. I am imagining that one could DIY it by plotting a vector, and possible plotting a point at it’s root with the marker being some text, but are there any build-in, convenient features for this? I can’t seem to find any.

http://makie.juliaplots.org/stable/abstractplotting_api.html#AbstractPlotting.annotations-Tuple

Something like:

julia> points = [Point2f0(cos(t), sin(t)) for t in LinRange(0, 2pi, 20)];

julia> colors = 1:20;

julia> figure, axis, scatterobject = scatter(points, color = colors, markersize = 15);

julia> AbstractPlotting.annotations!(string.('a':'z')[1:20], points, textsize = 0.1, font = "JuliaMono")
Annotations{Tuple{Vector{Tuple{String, Point{2, Float32}}}}}

EDIT: Apologies, my initial draft didn’t use JuliaMono font!

2 Likes

This example doesn’t really show that text is currently always drawn with axis scaling applied, so if your scaling is not approximately equal, the text will be really stretched. I have a PR waiting to fix this but the GLMakie support is still missing

1 Like