Reputation: 677
The following code:
import matplotlib.pyplot as plt
fig, axes = plt.subplots(ncols=3, nrows=4, sharex='col', sharey=False,\
subplot_kw=dict(adjustable='box-forced'), figsize=(8, 8))
fig, axes = plt.subplots(ncols=3, nrows=3, sharex='col', sharey=False,\
subplot_kw=dict(adjustable='box-forced'), figsize=(8, 8))
plt.show()
produces two plots:
The first plot has subplots distributed as ncols=3, nrows=4
. The size of each of these subplots is perfect for my need.
The second plot has subplots distributed as ncols=3, nrows=3
:
How could I make each of these subplots have the same dimensions as the subplots from the first plot?
Upvotes: 0
Views: 54
Reputation: 153460
One way is set that last line as "invisible":
import matplotlib.pyplot as plt
fig, axes = plt.subplots(ncols=3, nrows=4, sharex='col', sharey=False,\
subplot_kw=dict(adjustable='box-forced'), figsize=(8, 8))
fig, axes = plt.subplots(ncols=3, nrows=4, sharex='col', sharey=False,\
subplot_kw=dict(adjustable='box-forced'), figsize=(8, 8))
[ax.set_visible(False) for ax in axes[3,:]]
plt.show()
Upvotes: 2