Here is a MWE of a Makie plot with a wide figure with one square axis and a colorbar “attached” to it:
f = Figure(resolution=(900,300))
Axis(f[1, 1], aspect = AxisAspect(1))
Box(f[1, 1], color = (:blue, 0.2), strokecolor = :transparent)
Colorbar(f[1, 2])
which gives
As you can see the colorbar is quite far because the bounding box (indicated in blue) is quite wide (because it “fills” the figure size). While this might be OK for a figure with a single panel, it is not so great when there is another panel to the right. MWE #2:
f = Figure(resolution=(1200,300))
ga = f[1,1] = GridLayout()
Axis(ga[1, 1], aspect = AxisAspect(1))
Colorbar(ga[1, 2])
gb = f[1,2] = GridLayout()
Axis(gb[1, 1])
where we create two panels (GridLayout
s) where the left one has the colorbar. However, this gives
where the colorbar looks like it is attached to the right panel instead of the left one. So the question is: How does one “glue” the colorbar to the axis in the left panel?