How do I plot 5 subplots instead of 6 plots as a output to a jupyter notebook cell. I'm trying to plot 5 separate subplots but when I tried using,
fig, ax = plt.subplots(2, 3, figsize=(10, 7))
This is returning 6 subplots in two rows and three columns. What I'm trying to achieve is plotting 5 subplots in two rows?
Eg: In first row I need three subplots and in second row I need only two subplots instead of there.
How can I achieve this using matplotlib or seaborn?
import matplotlib.pyplot as plt
import numpy as np
fig=plt.figure(figsize=(10,7))
columns = 3
rows = 2
a=np.random.rand(2,3)
for i in range(1, 6):
fig.add_subplot(rows, columns, i)
plt.plot(a)### what you want you can plot
plt.show()
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