How do I annotate datapoints

Hello everyone, I have been using the Makie.jl package (more specifically CairoMakie) for the creation of figures for the project I am working on. I am currently creating a scatterplot and would like to annotate my datapoints with their identity; however, it is not clear to me how to do this. The only thing I can find about it in the documentation is the following:

annotations(strings::Vector{String}, positions::Vector{Point})

However, the position of the datapoints in my figure have both an x and a y. Does anyone know how to implement this in a scatterplot?

This is my code currently:

x=[1.0,2.0,3.0]
y=[1.0,2.0,3.0]
annotation=["A","B","C"]
location=[1.0 1.0 1.0
2.0 2.0 2.0
3.0 3.0 2.0]

fig = Figure()
tit = "Testannotation"
xlab = "x"
ylab = "y"

ax = Axis(fig[1, 1], xlabel = xlab, ylabel = ylab, title = tit)#
scatter!(x,y)
annotations!(annotation,location)

no matter what I do i always get the letters in the bottom left corner. I tried a vector and matrices and even single numbers for location. Somehow the function never produces an error regardless of what i put in and the position of the letters never changes. they are all displayed on top of each other in the bottom left corner.

Example figure:

Thanks in advance.

So after searching a lot i figured that text!() is probably what I am looking for which is outlined in the documentation linked here:

https://makie.juliaplots.org/stable/examples/plotting_functions/text/

However, all my attempts of using this function result in an error. Likewise, all of the examples presented in the documentation also result in the following error:

LoadError: MethodError: no method matching layout_text(::Int64, ::Float32, ::FreeTypeAbstraction.FTFont, ::Tuple{Symbol, Symbol}, ::Quaternionf, ::MakieCore.Automatic, ::Float64, ::ColorTypes.RGBA{Float32}, ::ColorTypes.RGBA{Float32}, ::Int64)

Examples i tried to run:

using CairoMakie

f = Figure()

Axis(f[1, 1], aspect = DataAspect(), backgroundcolor = :gray50)

scatter!(Point2f(0, 0))
text!(0, 0, text = "center", align = (:center, :center))

circlepoints = [(cos(a), sin(a)) for a in LinRange(0, 2pi, 16)[1:end-1]]
scatter!(circlepoints)
text!(
    circlepoints,
    text = "this is point " .* string.(1:15),
    rotation = LinRange(0, 2pi, 16)[1:end-1],
    align = (:right, :baseline),
    color = cgrad(:Spectral)[LinRange(0, 1, 15)]
)

f

and

using CairoMakie

aligns = [(h, v) for v in [:bottom, :baseline, :center, :top]
                 for h in [:left, :center, :right]]
x = repeat(1:3, 4)
y = repeat(1:4, inner = 3)
scatter(x, y)
text!(x, y, text = string.(aligns), align = aligns)
current_figure()

If an example from the docs doesn’t work that almost 100% of the time means that you need to use the newest versions, because the examples are regenerated on every docs update so they must work.

In this case, the option to do text!(x, y) where x and y are scalars was only added recently, which is where the error comes from.

Indeed I am able to run the examples after updating my packages. thanks for the help.