Created
February 8, 2024 07:51
-
-
Save jkrumbiegel/6ee194b9a07b5d67fd22fbb105b631bd to your computer and use it in GitHub Desktop.
Makie layout visualization boxes
This file contains 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() | |
Axis(f[1, 1], title = "Hey") | |
Axis(f[1, 2], title = "Ho") | |
Colorbar(f[1, 3]) | |
Label(f[2, :], "A long spanning label") | |
Colorbar(f[3, 1:2], vertical = false) | |
f | |
function show_layout(f::Figure) | |
fig = Figure(size = size(f.scene), backgroundcolor = :gray50) | |
for content in f.content | |
sbbox = content.layoutobservables.suggestedbbox[] | |
w, h = sbbox.widths | |
l, b = sbbox.origin | |
r, t = (l, b) .+ (w, h) | |
Box(fig, bbox = sbbox, color = :slategray2) | |
prot = content.layoutobservables.protrusions[] | |
if prot.right != 0 | |
Box(fig, bbox = BBox(r, r+prot.right, b, t), color = :tomato) | |
end | |
if prot.left != 0 | |
Box(fig, bbox = BBox(l-prot.left, l, b, t), color = :tomato) | |
end | |
if prot.bottom != 0 | |
Box(fig, bbox = BBox(l, r, b-prot.bottom, b), color = :tomato) | |
end | |
if prot.top != 0 | |
Box(fig, bbox = BBox(l, r, t, t+prot.top), color = :tomato) | |
end | |
end | |
fig | |
end | |
_f = show_layout(f) |
Author
jkrumbiegel
commented
Feb 8, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment