PYTHON Tutorial
import matplotlib.pyplot as plt
fig, axes = plt.subplots(nrows=2, ncols=2)
# رسم بياني 1
axes[0, 0].plot(x1, y1)
# رسم بياني 2
axes[0, 1].plot(x2, y2)
# رسم بياني 3
axes[1, 0].plot(x3, y3)
# رسم بياني 4
axes[1, 1].plot(x4, y4)
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Multiple Plots')
plt.show()
GridSpec
من matplotlib.gridspec
:from matplotlib.gridspec import GridSpec
GridSpec
:fig = plt.figure()
gs = GridSpec(2, 2)
# رسم بياني 1
ax1 = fig.add_subplot(gs[0, 0])
ax1.plot(x1, y1)
# رسم بياني 2
ax2 = fig.add_subplot(gs[0, 1])
ax2.plot(x2, y2)
# رسم بياني 3
ax3 = fig.add_subplot(gs[1, 0])
ax3.plot(x3, y3)
# رسم بياني 4
ax4 = fig.add_subplot(gs[1, 1])
ax4.plot(x4, y4)