如何在 Jupyter 笔记本中绘制没有图形编号的交互式 matplotlib 图形?

问题描述 投票:0回答:1

我在 Jupyter 实验室笔记本中使用 matplotlib 和

%matplotlib widget
。当我显示图形时,其上方会显示“图 1”。我怎样才能摆脱它?

我发现

plt.figure(num='', frameon=False)
确实显示了一个没有这个前缀的图形,但是它不是交互式的,我以后无法更新其内容(这就是我首先使用上述魔法的原因)。

python matplotlib jupyter-notebook jupyter-lab matplotlib-widget
1个回答
0
投票

您可以在制作交互式绘图后将其添加到下一个单元格中以至少更改为空:

#based on https://stackoverflow.com/a/73802955/8508004
man = plt.get_current_fig_manager()
man.set_window_title(" ")

不过,我还没有想出将其包含在同一个单元格中的方法。

© www.soinside.com 2019 - 2024. All rights reserved.