【发布时间】:2017-06-27 12:35:10
【问题描述】:
假设我有以下代码(matplotlib gridspec tutorial的修改版)
import matplotlib.pyplot as plt
def make_ticklabels_invisible(fig):
for i, ax in enumerate(fig.axes):
ax.text(0.5, 0.5, "ax%d" % (i+1), va="center", ha="center")
for tl in ax.get_xticklabels() + ax.get_yticklabels():
tl.set_visible(False)
plt.figure(0)
ax1 = plt.subplot2grid((3,3), (0,0), colspan=3)
ax2 = plt.subplot2grid((3,3), (1,0), colspan=2)
ax3 = plt.subplot2grid((3,3), (1, 2), rowspan=2)
ax4 = plt.subplot2grid((3,3), (2, 0))
plt.subplot2grid((3,3), (2, 1)) # OOPS! Forgot to store axes object
plt.suptitle("subplot2grid")
make_ticklabels_invisible(plt.gcf())
plt.show()
导致
如何“提取”ax5 并将其“全屏”绘制在单独的图中不必重新创建绘图?
【问题讨论】:
-
请发布您用于生成上面看到的绘图的代码。始终发布您的代码,这样其他人可以更轻松地帮助您。
-
感谢您的提示。我重新提出了这个问题。干杯!
标签: python matplotlib