简单的轴线网格

简单的轴线网格

  1. import matplotlib.pyplot as plt
  2. from mpl_toolkits.axes_grid1 import ImageGrid
  3. import numpy as np
  4. im = np.arange(100).reshape((10, 10))
  5. fig = plt.figure(1, (4., 4.))
  6. grid = ImageGrid(fig, 111, # similar to subplot(111)
  7. nrows_ncols=(2, 2), # creates 2x2 grid of axes
  8. axes_pad=0.1, # pad between axes in inch.
  9. )
  10. for i in range(4):
  11. grid[i].imshow(im) # The AxesGrid object work as a list of axes.
  12. plt.show()

下载这个示例