Reputation: 2962
I am creating two subplots, side by side, and for some reason they will only fill the top half of the figure.
grid = {'width_ratios':[3,1],'height_ratios':[1,1]}
self.fig, self.axes = plt.subplots(1,2, sharey=True, gridspec_kw=grid)
And here is what it looks like once I plot everything:
See how the bottom half of the image is blank? That is how it appears in the figure window. I want the entire figure of subplots to fill the window and be more square shaped, and I can't see any reason why it shouldn't, as I have written it.
Upvotes: 0
Views: 883
Reputation: 10258
By declaring 'height_ratios':[1,1]
you are creating two rows of subplots
; similarly 'height_ratios':[1,1,1]
will give you three rows, et cetera. So simply write 'height_ratios':[1]
, or leave out height_ratios
, and it is fixed.
It's seems strange to me that this setting overrides the explicit ... Well, it doesn't override the nrows, ncols
settings in Gridspec, but apparently that is what Matplotlib does.nrows, ncols
setting, but with 'height_ratios':[1,1]
you are still creating space for two rows of subplots
.
Upvotes: 1