# Automatic direct labels for Makie with Voronoi tessellation

**URL:** <https://discourse.julialang.org/t/automatic-direct-labels-for-makie-with-voronoi-tessellation/90247>\
**Category:** General Usage\
**Created:** [November 14, 2022, 4:37pm UTC](https://discourse.julialang.org/t/automatic-direct-labels-for-makie-with-voronoi-tessellation/90247 "2022-11-14T16:37:52Z")\
**Posts on this page:** 1\
**Showing post:** 6

<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:** [November 16, 2022, 11:37am UTC](https://discourse.julialang.org/t/automatic-direct-labels-for-makie-with-voronoi-tessellation/90247/6 "2022-11-16T11:37:02Z")

</div>

This might be a bug in `Makie.jl`.

This here draws a red box around the text, but the text is then placed wrongly.

```julia
using CairoMakie, StableRNGs                                                                                                                                                                                                 
x = cumsum(randn(StableRNG(1), 100).^2)                                                             
f = lines(x)                                                                                        
scene = campixel(f.axis.scene)                                                                      
lbl = text!(scene, 50, 50, text="Direct Labels are Great!", align=(:right,:bottom))                 
bb = boundingbox(lbl)                                                                               
wireframe!(scene, bb, color=:red, space=:pixel)                                                     
save("mwe_makie.png", f)         

```

What I changed is

1. remove `axis=(yscale=log10,)`
2. Create a new `Scene` with `campixel` and use that to place the `text`.

I think that both points interfer somehow with each other…

Here is the output:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/d/e/dea58468396e9e6ef1433fc090e8126b8e444414.png)

It was mentioned here [How to draw a textbox around a text in Makie.jl? - #2 by ffreyer](https://discourse.julialang.org/t/how-to-draw-a-textbox-around-a-text-in-makie-jl/75672/2) that `boundingbox` does not do the right thing. However, I could not get the workaround to work either (would need more time).

We should open an issue over at `Makie.jl`.

---

_[View the full topic](https://discourse.julialang.org/t/automatic-direct-labels-for-makie-with-voronoi-tessellation/90247)._
