# GLMakie -- text versus annotation -- annotation not working?

**URL:** <https://discourse.julialang.org/t/glmakie-text-versus-annotation-annotation-not-working/130854>\
**Category:** Visualization\
**Tags:** error, glmakie\
**Created:** [July 18, 2025, 5:37pm UTC](https://discourse.julialang.org/t/glmakie-text-versus-annotation-annotation-not-working/130854 "2025-07-18T17:37:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![diadora77](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/diadora77/32/220469_2.png) [@diadora77](https://discourse.julialang.org/u/diadora77)\
**Post date:** [July 18, 2025, 5:37pm UTC](https://discourse.julialang.org/t/glmakie-text-versus-annotation-annotation-not-working/130854/1 "2025-07-18T17:37:23Z")

</div>

Hi- Tried using [annotation](https://docs.makie.org/v0.22/reference/plots/annotation#annotation) according to the docs and receiving a recipe error. A minimum viable example is provide below which is very similar to the docs example.

```julia
ts = rand(10,2)
lbs = string.(1:10)

f = Figure()
ax = Axis(f[1,1], xlabel="x", ylabel="y")
scatter!(ax, pts)
text!(ax, pts, text = lbs)

ax2 = Axis(f[1,2], xlabel="x", ylabel="y")
scatter!(ax2, pts)
annotation!(ax2, pts, text = lbs)

f

```

Error received is:

```julia
julia> annotation!(ax2, pts, text = lbs)
ERROR: No recipe for annotation with args: Tuple{Matrix{Float64}}
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] plot!
   @ ~/.julia/packages/Makie/6zcxH/src/interfaces.jl:134 [inlined]
 [3] connect_plot!(parent::Scene, plot::Annotation{Tuple{Matrix{Float64}}})
   @ Makie ~/.julia/packages/Makie/6zcxH/src/compute-plots.jl:805
 [4] plot!
   @ ~/.julia/packages/Makie/6zcxH/src/interfaces.jl:211 [inlined]
 [5] plot!(ax::Axis, plot::Annotation{Tuple{Matrix{Float64}}})
   @ Makie ~/.julia/packages/Makie/6zcxH/src/figureplotting.jl:431
 [6] _create_plot!(::Function, ::Dict{Symbol, Any}, ::Axis, ::Matrix{Float64})
   @ Makie ~/.julia/packages/Makie/6zcxH/src/figureplotting.jl:401
 [7] annotation!(::Axis, ::Vararg{Any}; kw::@Kwargs{text::Vector{String}})
   @ Makie ~/.julia/packages/Makie/6zcxH/src/recipes.jl:521
 [8] top-level scope
   @ REPL[12]:1
 
julia>

```

---

<div class="post-metadata">

**Author:** ![eldee](https://avatars.discourse-cdn.com/v4/letter/e/b5a626/32.png) [@eldee](https://discourse.julialang.org/u/eldee)\
**Post date:** [July 18, 2025, 6:08pm UTC](https://discourse.julialang.org/t/glmakie-text-versus-annotation-annotation-not-working/130854/2 "2025-07-18T18:08:41Z")

</div>

Hi,

Note that in the documentation example, `points` is a `Vector{Tuple{Float64, Float64}}`, while you’re supplying a `Matrix`. If you also use that here, via

```julia
annotation!(ax2, Tuple.(eachrow(pts)), text = lbs)

```

everything works fine.

* * *

In general it’s often unclear to me when Makie will accept a `Matrix` (normally you’d use 2 \times n though), but in my experience, a `Vector{Point2f}` (or `Vector{Point3f}` in 3D) never gives any issues and is more descriptive than a `Matrix`. So when in doubt, I’d advise to use that.

```julia
annotation!(ax2, Point2f.(eachrow(pts)), text = lbs)

```

---

<div class="post-metadata">

**Author:** ![technocrat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/technocrat/32/220947_2.png) [@technocrat](https://discourse.julialang.org/u/technocrat)\
**Post date:** [July 18, 2025, 6:09pm UTC](https://discourse.julialang.org/t/glmakie-text-versus-annotation-annotation-not-working/130854/3 "2025-07-18T18:09:57Z")

</div>

The signature for `annotation` doesn’t take a matrix, it requires individual points, like this

```julia
  ? annotation
  annotation(x_target, y_target)
  annotation(x_label, y_label, x_target, y_target)
  annotation(points_target)
  annotation(points_label, points_target)

```

So,

```julia
f = Figure()
ax = Axis(f[1,1], xlabel="x", ylabel="y")
scatter!(ax, pts)
text!(ax, pts, text = lbs)

ax2 = Axis(f[1,2], xlabel="x", ylabel="y")
scatter!(ax2, pts)
# Fix: Convert matrix to individual points for annotation!
for i in 1:size(pts, 1)
    annotation!(ax2, pts[i,1], pts[i,2], text = lbs[i])
end
f

```

will get you

 ![Screenshot 2025-07-18 at 11.09.44 AM](https://global.discourse-cdn.com/julialang/original/3X/a/3/a358cec16f66124df9355249fd31290e7834350a.png)

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [July 19, 2025, 7:52am UTC](https://discourse.julialang.org/t/glmakie-text-versus-annotation-annotation-not-working/130854/4 "2025-07-19T07:52:03Z")

</div>

the error could definitely get improved

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [July 19, 2025, 9:04am UTC](https://discourse.julialang.org/t/glmakie-text-versus-annotation-annotation-not-working/130854/5 "2025-07-19T09:04:20Z")

</div>

It’s just a missing convert, I didn’t reuse the PointLike trait because the signature can be more complex, so some conversions you’re used to from scatter etc. are probably missing, like the matrix here

---

<div class="post-metadata">

**Author:** ![diadora77](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/diadora77/32/220469_2.png) [@diadora77](https://discourse.julialang.org/u/diadora77)\
**Post date:** [July 19, 2025, 11:55am UTC](https://discourse.julialang.org/t/glmakie-text-versus-annotation-annotation-not-working/130854/6 "2025-07-19T11:55:45Z")

</div>

Ah, thanks. I should have dug a little more and caught that. I think i was more surprised that `text!` and `annotation!` responded differently to same input.
