I have a matplotlib figure on a canvas on a wxpython panel. My application is run real-time and the user can re-size the window frame. However, when this happens, the borders around my axes go out of whack.
I know I can use the function fig.subplots_adjust to adjust the borders, but the values specified in the function are percentages, so there is a TON of wasted space around the borders when maximized, even though the space is just right when the window is smaller.
Is there anything similar to this function where I can specify the border in something like pixels so that the border is the same width no matter what size the frame is?
As always, Thanks!
Here is an example of how this can be done. The code defines a function which translates pixel border values into percentages based on the current figure size. It also hooks up an event listener that will adjust the borders when the figure is resized: