matplotlib / matplotlib/ipympl

ipympl not working nicely with interact

未关闭
#36 10 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Jupyter Notebook
星标
1.7k
派生
234
PR 合并指标
30 天内没有已合并 PR

描述

Trying to follow some simple examples of Jupyter widgets with matplotlib, but I'm having issues when using the ipympl backend. The first update to a plot produces a second plot (overplotted), and the second update just erases the figure window altogether. This does not happen when using inline.

Here's some simple code to reproduce the issue:

%matplotlib ipympl
import matplotlib.pyplot as plt
from ipywidgets import interact

def f(n):
    plt.plot([0,1,2],[0,1,n])
    plt.show()
interact(f,n=(0,10));

If I use inline, this will update the line plot. With ipympl it fails.

I am using ipympl 0.1.0 from Anaconda, together will other packages:

ipywidgets                7.0.0              py36_intel_0  [intel]  intel
ipympl                    0.1.0                    py36_1    conda-forge
matplotlib                2.0.2           np113py36_intel_1  [intel]  intel
ipython                   6.1.0              py36_intel_0  [intel]  intel
jupyter                   1.0.0              py36_intel_5  [intel]  intel
jupyter_client            5.1.0              py36_intel_0  [intel]  intel
jupyter_console           5.1.0              py36_intel_0  [intel]  intel
jupyter_core              4.3.0              py36_intel_1  [intel]  intel

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

运行提供的 ipympl 和 interact reproducer,然后将其 figure-update 行为与 inline backend 进行比较。跟踪涉及重复调用 interact 的 ipympl backend 和 widget update 路径;完成标准是更新能够保持一个 plot 可见,而不会擦除 figure。

由索引模型根据 Issue 内容生成。

评估

技术栈
jupyter, jupyter-notebook, python
领域
data-visualization, frontend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。