擅长:python、mysql、java
<p>另一个选项是使用plt。图:</p>
<pre><code>import matplotlib.pyplot as plt
plt.figure(1) # the first figure
plt.subplot(211) # the first subplot in the first figure
plt.plot([1, 2, 3])
plt.subplot(212) # the second subplot in the first figure
plt.plot([4, 5, 6])
plt.show(block=False)
plt.figure(2) # a second figure
plt.plot([4, 5, 6]) # creates a subplot(111) by default
plt.show(block=False)
plt.figure(1) # figure 1 current; subplot(212) still current
plt.subplot(211) # make subplot(211) in figure1 current
plt.title('Easy as 1, 2, 3') # subplot 211 title
plt.show(block=False)
</code></pre>
<p>(见:<a href="https://matplotlib.org/users/pyplot_tutorial.html" rel="nofollow noreferrer">https://matplotlib.org/users/pyplot_tutorial.html</a>)</p>