Choosing optimal figure width/height automatically

Joe, thank you very much for your reply. So the "figsize" of a
matplotlib plot is the physical size of the region between the axes
where the data is shown? If this is indeed the case, as it seems, then
achieving (almost) what I wanted is as easy as setting a figsize with
the proper aspect ratio, like in your example.

Before your reply, I believed that "figure size" in matplotlib refers to
the size of the whole figure (including axes, axis labels, and borders),
as "figure" in matplotlib seems to be a name for instances of
matplotlib.figure.Figure which are the whole thing.

I said "almost" in the first paragraph as it would be nice if there was
a way to create figures that have a given total width (after cropping)
at a given font size. The reason is this: In many scientific journals
(for example Physical Review), figures are scaled to have the same width
as a column of text.

If I prepare a bunch of figures with the same width "within the axes"
and consistent font sizes and line widths, the resulting figures will
typically have somewhat different total widths. After scaling the
figures to the same width, the font sizes and line widths will differ
slightly from figure to figure.