Skip to content

Instantly share code, notes, and snippets.

@jkrumbiegel
Created November 16, 2023 07:21
Show Gist options
  • Save jkrumbiegel/3325dd0633fd3efc3d7831f3c64f2816 to your computer and use it in GitHub Desktop.
Save jkrumbiegel/3325dd0633fd3efc3d7831f3c64f2816 to your computer and use it in GitHub Desktop.
Makie Axis brackets over tick labels
f = Figure()
ax = Axis(f[1, 1], xticks = 1:10)
textplot = ax.xaxis.elements[:ticklabels].plots[1].plots[1]
glyphcollections = textplot[1]
bracket!(ax.blockscene, lift(textplot.position, glyphcollections, textplot.rotation) do positions, gcs, rot
bboxes = map(positions, gcs) do pos, gc
Makie.boundingbox(gc, pos, Makie.to_rotation(rot))
end
left = Makie.bottomleft(Rect2f(bboxes[4]))
right = Makie.bottomright(Rect2f(bboxes[5]))
[(left, right)]
end, orientation = :down, style = :square, width = 5)
f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment