How to link axes in a Makie figure?

Suppose I have a figure with multiple subfigures:

using GLMakie

fig = Figure()
scatter(fig[1,1], rand(10))
scatter(fig[1,2], rand(10))

How to link all axes in the figure? I am aware of linkaxes! but it expects axes objects as input.

Is there a section of the documentation explaining the relationship between figures, scenes, axes and how to extract one from another?

The figure has a content vector where objects that were created with Axis(f... etc should be stored. So you can filter axes from there. You can also go through the nested layouts but that’s more work. Layouts are kind of decoupled from figures, something can be in a layout but doesn’t have to be in the figure, and vice versa.

f = Figure()
for i in 1:4, j in 1:4
    scatter(f[i, j], randn(10, 2))

linkaxes!(filter(x -> x isa Axis, f.content)...)

1 Like

Thank you @jules , am I correct that linking Axis3 is currently not available?

Yes it lacks the infrastructure for that. Also I’m not sure how I would want that to work, and it might need a rework of Axis as well

1 Like