Programmatically Get Makie Figure Size

Hello,

Is it possible to programmatically get the width and height of a figure in Makie assuming you did not explicitly specify them in the call to Figure()?

I’m curious because they would be helpful for placing a zoom box (BBox) on the figure. I could specify the location using normalized coordinates (between 0 and 1) and then scale them by the width or height of the figure.

I was able to find the fields within the figure object but I can’t seem to extract the number from them. My expectation is they would be specified based on some default value in units of pixels. That might be wrong, just my initial expectation.

fig.layout.width[] # Auto(true, 1.0f0)
fig.layout.height[] # Auto(true, 1.0f0)

fig.scene.viewport is the observable that holds the main scene rectangle

Cool - thanks. So here it is.

fig.scene.viewport[].widths # two element vector holding width and height in pixels

figure.scene.viewport[] should have it!

edit: whoops, replied by email and didn’t see the original thread :smiley: