I would like to have a set of subplots divided in three lines with one subplot on the first line, two on the second and three on the third. I did the following :
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))
Thus I get :
How can I remove the three empty plots ?
How about this?
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))
It seems to produce a plot you're looking for:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With