Hey,
I’m building an application on PyQt5 with Matplotlib embbeded. When I display the figure and move it around with Matplotlib’s toolbar, it leaves a frame, and the figure hides behind its limmits.
I’m having trouble figuring out how to remove this frame and ploting the image centralized on the widget itself. So overall, I would like to remove the frames and plot the image centralized on the white area.
Here is an example on the problem. If someone could help, I would appeciate it
This is the expected behavior. The image has some extent within an Axes, the pan tool changes the view limits of the Axes, so as you pan part of the image may move out of the view limits but the Axes stays in place relative to the Figure (Quick start guide — Matplotlib 3.6.2 documentation is a good place to look for a glossary of the terms Matplotlib uses).
It looks like you have turned off all of the ticks and tick labels, if you leave those in place the behavior would be clearer.
Without any code it is hard to guess what the easiest way for you get what you want is, but I suggest looking at either Figure.figimage or making the Axes fill the whole Figure.
The main things would be plotting it closer to the top of the widget or, as you suggested, make the axis fill the entire figure. But I’m having trouble figuring out how to do both.