以下代码:
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()制作两个情节:
第一个地块的子图分布为ncols=3, nrows=4。每个子图的大小都非常适合我的需要。

第二个地块的子图分布为ncols=3, nrows=3。

我如何才能使每个子图都具有与第一个子图相同的维度?
发布于 2018-05-31 14:49:05
一种方法是将最后一行设置为“不可见的”:
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()


https://stackoverflow.com/questions/50626989
复制相似问题