绘制比matplotlib子图中指定的图少的图

use*_*827 10 python matplotlib

fig, ax = plt.subplots(3, 3, sharex='col', squeeze=False, figsize=(20, 10))
Run Code Online (Sandbox Code Playgroud)

我想绘制7个子图并使用上面的命令.然而,它创建了9个图(包括2个空图).我怎样才能确保只绘制了7个地块?

Ser*_*ity 9

import matplotlib.pyplot as plt

fig, axs  = plt.subplots(3,3)
fig.delaxes(axs[-1, -1])
fig.delaxes(axs[-1, -2])

plt.show()
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述