# CairoMakie Text Box

**URL:** <https://discourse.julialang.org/t/cairomakie-text-box/103783>\
**Category:** General Usage\
**Tags:** makie, cairomakie\
**Created:** [September 12, 2023, 11:48am UTC](https://discourse.julialang.org/t/cairomakie-text-box/103783 "2023-09-12T11:48:25Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![fatteneder](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fatteneder/32/33991_2.png) [@fatteneder](https://discourse.julialang.org/u/fatteneder)\
**Post date:** [September 12, 2023, 12:08pm UTC](https://discourse.julialang.org/t/cairomakie-text-box/103783/3 "2023-09-12T12:08:22Z")

</div>

And here is one way (probably not the most optimal one though) to get a box with outline and color into the plot

```julia
using CairoMakie, Printf

begin
    # these will be coming from some results struct like
    # (; param1, param2, param3) = my_run_result
    param1 = 1
    param2 = "param"
    param3 = 0.5

    x = LinRange(-1, 1, 100)
    y = x .^ 3

    fig, ax, ln = lines(x, y, label="Plot 1")
    axislegend(position=:lt)
    fmt = "Param 1 = %d \n Param 2 = %s \n Param 3 = %.2e"
    gl = GridLayout(fig[1,1],
                    tellwidth = false, tellheight = false,
                    halign = :center, valign = :top)
    box = Box(gl[1, 1], color = (:orange,0.5), strokecolor = :black)
    lbl = Label(gl[1, 1], Printf.format(Printf.Format(fmt), param1, param2, param3), padding = (10, 10, 20, 20))
    # optionally: bring box and label in front of axis ticks
    # translate!(box.blockscene, (0,0,100))
    # translate!(lbl.blockscene, (0,0,100))

    fig
end

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/6/9/69b29295dcc86a4a515aa2eeea0b6ba381637042.png)

---

_[View the full topic](https://discourse.julialang.org/t/cairomakie-text-box/103783)._
