【发布时间】:2016-09-26 08:36:13
【问题描述】:
有两个轴面板,一个小的(灰色)在一个大的(白色)中。
使用以下代码,我希望蓝线位于灰色小轴面板的顶部,因为蓝线设置为具有高得离谱的zorder。但事实证明并非如此。
更改小面板的patch的zorder没有效果。
如果我将小面板的背景设置为透明(或使其不可见),那么蓝线会显得通畅,但这种解决方案并不理想,因为可能存在 IT IS REQUIRED 的情况 保持小面板的背景不透明。
或者,如果通过实现线的zorder 仅在相同的轴内有意义,那么这种要求可能无法以简单的方式实现?
f = figure()
ax1 = f.add_axes([0.1,0.1,0.8,0.8], zorder=1)
ax2 = f.add_axes([0.3,0.2,0.5,0.4], zorder=2)
ax2.patch.set_facecolor('gray')
ax2.patch.set_zorder(-9999999)
ax1.plot([0,1], [0,1], zorder=99999999, color='blue')
ax2.plot([0,1], [0,3], zorder=-99999, color='red')
# New Edit:
# To make the problem more to the point, what if someone
# also wants the background of the big panel to be green
# (with the following command)? See the second figure.
ax1.patch.set_facecolor('green')
# This seems to mean that the small panel really has to
# somehow "insert" into the z-space between the big panel
# and the blue line.
【问题讨论】:
标签: python python-2.7 matplotlib data-visualization