xxxxxxxxxx
#"plt" is the standard alias.
import matplotlib.pyplot as plt
xxxxxxxxxx
fig,ax = plt.subplots(3,2,figsize=(25,10),)
i,j = 0,0
for each in list_of_images:
img = cv.imread(each.name)
ax[i,j].imshow(img)
if j == 1:
j = 0
if i != 2:
i += 1
else:
j += 1
xxxxxxxxxx
import matplotlib.pyplot as plt
# Create some sample data
x = [1, 2, 3, 4, 5]
y1 = [1, 4, 9, 16, 25]
y2 = [1, 2, 3, 4, 5]
# Create subplots with 2 rows and 1 column
fig, axs = plt.subplots(2, 1)
# Plot data on the first subplot
axs[0].plot(x, y1)
axs[0].set_title('Plot 1')
axs[0].set_xlabel('X-axis')
axs[0].set_ylabel('Y-axis')
# Plot data on the second subplot
axs[1].plot(x, y2)
axs[1].set_title('Plot 2')
axs[1].set_xlabel('X-axis')
axs[1].set_ylabel('Y-axis')
# Adjust the layout to avoid overlapping of labels and titles
fig.tight_layout()
# Show the plot
plt.show()
xxxxxxxxxx
# Example with 3 figures (more can be added)
fig, (fig1, fig2, fig3) = plt.subplots(1, 3) # subplots(row, columns)
fig1.plot(x,y)
fig2.plot(x,y)
fig3.plot(x,y)
plt.show()