Matplotlib: plt.subplot

define

subplot(nrows, ncols, plot_number)

!note:

plot_number starts at 1, increments across rows first and has a maximum of nrows * ncols.

test

  • code
import matplotlib.pyplot as plt   
  
plt.figure(1) 
plt.subplot(2,2,2)
plt.subplot(2,2,3) 

plt.figure(2)
plt.subplot(2,1,1)
plt.subplot(2,1,2)
  
plt.show()  
  • result
Matplotlib: plt.subplot_第1张图片
figure1
Matplotlib: plt.subplot_第2张图片
figure2

read more

  • 官方文档

  • pylab_examples example code: subplots_demo.py

你可能感兴趣的:(Matplotlib: plt.subplot)