Created
November 16, 2023 07:21
-
-
Save jkrumbiegel/3325dd0633fd3efc3d7831f3c64f2816 to your computer and use it in GitHub Desktop.
Makie Axis brackets over tick labels
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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