以编程方式停止Jupyter笔记本中特定图形的交互 [英] Programmatically Stop Interaction for specific Figure in Jupyter notebook

查看:78
本文介绍了以编程方式停止Jupyter笔记本中特定图形的交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果不需要在Jupyter笔记本中为特定的matplotlib图形进行交互,那么如何以编程方式防止这种情况发生?

In case there is no need for interaction for a specific matplotlib figure in a Jupyter notebook, how to prevent that programmatically?

可以通过按Ctrl-w或单击停止互动"来手动完成按钮.我正在寻找对同一操作的API访问权限.

Manually that can be done by pressing Ctrl-w or clicking the "Stop Interaction" button. I am looking for the API access to the same operation.

原因:

  • 交互式图形使用的资源和警告显示的数字过多.
  • 每次执行单元格时手动关闭它们都不方便
  • 没有交互式框架的图形会更紧凑.

推荐答案

您可以在具有交互性的笔记本模式和没有交互性的 inline 模式之间切换:

You can switch between notebook mode with interactivity and inline mode without such interactivity with:

%matplotlib inline

%matplotlib notebook

您可以在笔记本中以编程方式执行以下操作:

You can do this programmatically in the notebook with:

get_ipython().magic('matplotlib notebook')

或:

get_ipython().magic('matplotlib inline')

这篇关于以编程方式停止Jupyter笔记本中特定图形的交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆