'Scale matplotlib window to match content

I am looking for a way to scale this plot/window, so that it is readable. I can manually adjust the window size, though I would want to have this happen automatically, depending on the size of the plot.

Plot image



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source