Ger*_*Ger 1 python matplotlib subplot
我想将一组子图分成三行,第一行有一个子图,第二行有两个,第三行有三个。我做了以下事情:
fig, axes = plt.subplots(figsize=(10, 10), sharex=True, sharey=True, ncols=3, nrows=3)
x = np.linspace(0, 10, 100)
for i in range(3):
for j in range(0, i+1):
axes[i, j].plot(x, np.sin((i+j) *x))
Run Code Online (Sandbox Code Playgroud)
如何删除三个空地块?
这个怎么样?
fig, axes = plt.subplots(figsize=(10, 10), sharex=True, sharey=True, ncols=3, nrows=3)
x = np.linspace(0, 10, 100)
for i in range(3):
for j in range(3):
if i<j:
axes[i, j].axis('off')
else:
axes[i, j].plot(x, np.sin((i+j) *x))
Run Code Online (Sandbox Code Playgroud)
它似乎产生了你正在寻找的情节:
| 归档时间: |
|
| 查看次数: |
1247 次 |
| 最近记录: |