matplotlib: Set width or height of figure without changing aspect ratio
matplotlib, python
Solution
I've learned that matplotlib actually just uses a constant default figure size for all figures. This value is stored in the `rcParams`, and can be viewed with
plt.rcParams["figure.figsize"]
This returns `[6.0, 4.0]` for me.
If you want to keep the same width to height ratio (ie "aspect ratio"), you can, for example, double it with:
plt.rcParams["figure.figsize"] = [2 * i for i in plt.rcParams["figure.figsize"]]
Problem
I'd like to choose the width of a figure, while still letting matplotlib choose the aspect ratio that it finds suitable. Every method I know to change the figure size requires a (width, height) tuple, which forces a certain aspect ratio. Is there any way to specify just the width (or just the height) and allow matplotlib to choose a suitable aspect ratio?