This might be a bug in Makie.jl
.
This here draws a red box around the text, but the text is then placed wrongly.
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
- remove
axis=(yscale=log10,)
- Create a new
Scene
withcampixel
and use that to place thetext
.
I think that both points interfer somehow with each other…
Here is the output:
It was mentioned here How to draw a textbox around a text in Makie.jl? - #2 by ffreyer 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
.