Gridspec演示01

Gridspec演示01

  1. import matplotlib.pyplot as plt
  2. def make_ticklabels_invisible(fig):
  3. for i, ax in enumerate(fig.axes):
  4. ax.text(0.5, 0.5, "ax%d" % (i+1), va="center", ha="center")
  5. ax.tick_params(labelbottom=False, labelleft=False)
  6. fig = plt.figure(0)
  7. ax1 = plt.subplot2grid((3, 3), (0, 0), colspan=3)
  8. ax2 = plt.subplot2grid((3, 3), (1, 0), colspan=2)
  9. ax3 = plt.subplot2grid((3, 3), (1, 2), rowspan=2)
  10. ax4 = plt.subplot2grid((3, 3), (2, 0))
  11. ax5 = plt.subplot2grid((3, 3), (2, 1))
  12. fig.suptitle("subplot2grid")
  13. make_ticklabels_invisible(fig)
  14. plt.show()

下载这个示例