I found tight_layout function for pyplot and want to use it. In my application I embed matplotlib plots into Qt GUI and use figure and not pyplot. Is there any way I can apply tight_layout there? Would it also work if I have several axes in one figure?
I found tight_layout function for pyplot and want to use it. In my application
Share
Just call
fig.tight_layout()as you normally would. (pyplotis just a convenience wrapper. In most cases, you only use it to quickly generate figure and axes objects and then call their methods directly.)There shouldn’t be a difference between the
QtAggbackend and the default backend (or if there is, it’s a bug).E.g.
Before Tight Layout
After Tight Layout