- Matplotlib 3.0 Cookbook
- Srinivasa Rao Poladi
- 55字
- 2021-08-13 15:16:05
How to do it...
The following code block draws three plots in one figure:
- Define the figure and its layout with three axes:
fig = plt.figure()
ax1 = plt.subplot(221)
ax2 = plt.subplot(222)
ax3 = plt.subplot(212)
- Plot the line graphs on each of the axes:
ax1.plot([1,2])
ax2.plot([2,1])
ax3.plot([2,4])
- Display the plot on the screen:
plt.show()