I am not sure why the canvas inside mplwidget has some margin on all sides even when the layout margins have been set to 0.
In Qt Designer:
Runtime:
The same issue can be seen in this sample chapter of the Matplotlib for Python Developers ebook (see page 38).
I've been trying out different examples and I noticed that this issue does not exist in simpler layouts: