Is there an easy and reliable way to determine the current aspect ratio of an axes when its aspect is set to 'auto'?
The obvious thing to check is ax.get_aspect(), but that just returns 'auto'. I can set it to an arbitrary constant value by ax.set_aspect(aspect), after which that same constant is returned by ax.get_aspect(). By default (and very usefully) we have aspect = 'auto', in which case the aspect ratio is automatically calculated and adjusted to match the data limits and axes size.
How can I get the numeric aspect ratio that was automatically selected?
To clarify, this is neither the aspect ratio of the data limits returned by ax.get_data_ratio(), nor the aspect ratio of the display size of the figure or subplot returned by fig.get_figheight() / fig.get_figwidth() (for the figure). It's a bit subtle, as it depends on both the display size and the data limits. (Which can lead to confusing the different ratios and the reason I find it important to have it easily accessible.)