# Makie Label

**URL:** https://discourse.julialang.org/t/makie-label/109721
**Category:** Visualization
**Created:** [February 5, 2024, 3:38am UTC](https://discourse.julialang.org/t/makie-label/109721 "2024-02-05T03:38:29Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)
#### Post date: [February 5, 2024, 3:38am UTC](https://discourse.julialang.org/t/makie-label/109721/1 "2024-02-05T03:38:29Z")

</div>

Is this supposed to work?

```julia
julia> let f = Figure()
           ax = Axis(f[1,1])
           Label(ax, "hello")
           f
       end
ERROR: MethodError: no method matching _block(::Type{Label}, ::Axis; text::String)

Closest candidates are:
  _block(::Type{<:Makie.Block}, ::Union{Figure, Scene}, ::Any, ::Dict, ::Any; kwdict_complete) got unsupported keyword argument "text"
   @ Makie ~/.julia/packages/Makie/z2T2o/src/makielayout/blocks.jl:308
  _block(::Type{<:Makie.Block}, ::Union{Figure, Scene}, Any...; bbox, kwargs...)
   @ Makie ~/.julia/packages/Makie/z2T2o/src/makielayout/blocks.jl:275
  _block(::Type{<:Makie.Block}, ::Union{GridPosition, GridSubposition}, Any...; kwargs...)
   @ Makie ~/.julia/packages/Makie/z2T2o/src/makielayout/blocks.jl:263

Stacktrace:
     ⋮ internal @ Makie
 [2] Label(x::Axis, text::String; kwargs::@Kwargs{})
   @ Makie ~/.julia/packages/Makie/z2T2o/src/makielayout/blocks/label.jl:1

(@main) pkg> st CairoMakie
Status `~/.julia/environments/main/Project.toml`
  [13f3f980] CairoMakie v0.11.8

```

---

<div class="post-metadata">

### Author: ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)
#### Post date: [February 5, 2024, 3:45am UTC](https://discourse.julialang.org/t/makie-label/109721/2 "2024-02-05T03:45:51Z")

</div>

I don’t think so. The `Label` expects the position in the layout as first parameter. This works:

```julia-repl
julia> let f = Figure()
           ax = Axis(f[1,1])
           Label(f[1,1], "hello")
           f
       end

```

See for example the [Layout tutorial - Subplot Labels](https://docs.makie.org/stable/tutorials/layout-tutorial/#subplot_labels).

Edit: To put text on a plot (within an `Axis`) you should use [`text(!)`](https://docs.makie.org/stable/reference/plots/text/)

---

<div class="post-metadata">

### Author: ![asinghvi17](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asinghvi17/32/8272_2.png) [@asinghvi17](https://discourse.julialang.org/u/asinghvi17)
#### Post date: [February 7, 2024, 2:37am UTC](https://discourse.julialang.org/t/makie-label/109721/3 "2024-02-07T02:37:15Z")

</div>

If you’re looking for a title for an axis, you can set `ax.title`, or provide the `title` keyword

---

<div class="post-metadata">

### Author: ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)
#### Post date: [February 7, 2024, 2:44am UTC](https://discourse.julialang.org/t/makie-label/109721/4 "2024-02-07T02:44:36Z")

</div>

Why does `Label` take a position rather than an `Axis`? Would it make sense to allow it to take an axis?

---

<div class="post-metadata">

### Author: ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)
#### Post date: [February 7, 2024, 5:55am UTC](https://discourse.julialang.org/t/makie-label/109721/5 "2024-02-07T05:55:12Z")

</div>

“Why” is kind of a bad question 🙂 The authors of Makie chose to have a `Block` that just draws a text and call it `Label`. Other `Block`s are for example `Axis` or `Button` or `Textbox`. You see Makie is half of a UI-Toolkit with which you can build quite interactive applications. Here is [a list of all `Block`s](https://docs.makie.org/stable/reference/blocks/).

So you see a `Label` is not really meant for usage on a graph. It is it’s own indepent thing. If you just want to annotate a graph, i.e. but some text somewhere on the plot, then `Label` is not what you want to do. For annotation you should use the function `text!`

---

<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: [February 7, 2024, 7:23am UTC](https://discourse.julialang.org/t/makie-label/109721/6 "2024-02-07T07:23:57Z")

</div>

`Label` is really just a wrapper around one `text` plot, with the wiring set up so that it’s dimensions can be communicated to the layout. This has overhead though, so you wouldn’t want every text in your plot to be a `Label`.
