Figure Layout Dimensions

I’m trying to find the dimensions of components of my layout programmatically. I know I can get the GridLayout of a figure (“fig”) with fig.layout. But if I want to return the actual physical locations of fig[2,1], I can’t find how to call that data. I’m looking for the kind of data I would put into bbox = BBox()?

Thanks.

What are you trying to do? I don’t think there’s a convenience function to get a cell interior bbox right now, you can get the assigned boundingbox for any object via obj.layoutobservables.suggestedbbox I think. Although that’s internal

I’m trying to get insets graphs of different dimensions to a common size and specific position inside figure. I have several of these with insets of various size, but all are basically comprised of 3 by 3 grids. So the master figure might be as below:

And then I’m trying to inset into the lower quadrant this:

And this:

CPEB3_P3_label

Each of these are comprised of three heat maps at fig[1,1], fig[1,2], and fig[2,2].

I want to keep the dimensions of the 3x3 grids that make up each inset the same so that the inset with a 7x7 grid of 3x3s is proportional to the 3x3 grid of 3x3s (and any other inset I use). So I was hoping I could come up with the dimensions of each fig[i,j] so that I could calculate position and size to keep it proportional.

Hope that makes some sense.

JB

So the internal 3x3s should be the same size, no matter if there are 3x3 or 7x7 of them?

How should the placement below the triangular plot look, should there be one of the lower heatmaps assemblies there, or multiple?

You can grab the ax.scene.px_area observable for example, that’s the rectangle of the inner area of the big plot. From that you could compute another rectangle for the lower left corner, and place the inset assembly using that as the bbox parameter.

As pseudocode

r1 = big_ax.scene.px_area
r2 = lift(r1) do r
    compute_small_bbox(r)
end

gl = GridLayout(bbox = r2)
gl[1, 1] = Axis(fig)

That’s just one idea, it depends on what exactly you need. Maybe a mockup plot where you highlight what the main problem is would be helpful. It seems quite possible to do what you want, but I guess this is about finding a “convenient” solution as well.

You can also just place the GridLayout in the axis cell actually, and scale it via Relative sizes.

f = Figure()
bigax = Axis(f[1, 1])
gl = f[1, 1] = GridLayout(width = Relative(0.5), height = Relative(0.5), valign = :bottom, halign = :left)
# then place stuff into gl