-1
此图片文字情节使用:
subplot(1,2,1)
hist(...)
subplot(1,2,2)
text(...)
但我不希望第二绘图区边界,我希望在左上角的文字剧情。我怎么做到的?
此图片文字情节使用:
subplot(1,2,1)
hist(...)
subplot(1,2,2)
text(...)
但我不希望第二绘图区边界,我希望在左上角的文字剧情。我怎么做到的?
试试这个:
subplot(1,2,1)
hist(...)
ax2 = subplot(1,2,2)
ax2.set_xticks([])
ax2.set_yticks([])
for spine in ax2.spines.values():
spine.set_visible(False)
ax2.invert_yaxis()
ax2.text(..., verticalalignment="top")
更新:
正如评论指出的那样,你也可以这样做:
subplot(1,2,1)
hist(...)
ax2 = subplot(1,2,2)
ax2.axis("off")
ax2.invert_yaxis()
ax2.text(..., verticalalignment="top")
这虽然会删除默认轴背景太(取决于您的设置和Matplotlib版本,这可能会使您留下灰色背景色)。
谢谢,这是完美的。 – Howard
为此,您可以在第二个图上使用'plt.axis('off')'。 – umutto
是的,我检查了Axes API,并用'ax2.set_axis_off()'替换它。' – Howard