Indeed, it should have been in the list of links, as this is where I found the colsize!(f.layout, 1, Aspect(1, 1.0))
line.
The documentation is very nicely written, by the way.
You can determine the limits from ax.finallimits
Indeed, with it (and the awesome resize_to_layout!
) the appearance is just right:
let
fig = Figure(resolution=(700,300))
ax = Axis(fig[1, 1])
lines!(ax, Circle(Point2f(0, 0), 1))
lines!(ax, Circle(Point2f(0, 1), 1))
Colorbar(fig[1, 2])
colsize!(fig.layout, 1, Aspect(1, /(ax.finallimits[].widths...)))
resize_to_layout!(fig)
fig
end
you don’t need to set aspect = DataAspect() at all
It’s written in several places, but I thought I was misunderstanding,
as getting the limits aspect ratio seemed hard (thanks for the ax.finallimits[]
tip !).
And in controlling_axis_aspect_ratios,
DataAspect
uses the currently chosen axis limits and brings the axes into the same aspect ratio.
seemed to do the exact right thing: tell the layout what aspect ratio this particular Axis should have.
But it rather just tells the Axis
, not the layout.
The animation just below explains why layout cell and Axis must have separate meanings (this makes sense now).
Last puzzle: what is the meaning of the Aspect
first argument (index) ?