matplotlib / matplotlib/ipympl

Follow-up to #343 - Embedding Static Plots

未关闭
#359 11 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

#343 was a huge step forward for saving the state of plots in notebooks. But it doesn't truly reproduce the state of the notebook that the author was looking at for these two cases:

  1. If widget state is saved then only a blank figure renders (https://github.com/matplotlib/ipympl/pull/343#issuecomment-920167467)
  2. Any updates to the figure after the initial render are not saved in the notebook (https://github.com/matplotlib/ipympl/pull/343#issuecomment-921008926)

I think part 2 is very important to be able to tell a story using a notebook. e.g. If I make some plots with a slider, get them just so and then run nbconvert I don't think I would faithfully reproduce the state of the notebook as I was looking at it.

Part 1 should be solvable if we include the PNG as part of the widget model

Part 2 I think a reasonable tradeoff would be to only update the static plot whenever the notebook is saved. This would require the frontend of ipywidgets (jupyterlab-manager, and widgetsnbextension) to listen to notebook save signals and pass them to the ipympl frontend, which would in turn let the backend know to update the mimebundle.

@martinRenou how hard do you think the second one (saving) would be to fix? To me that feels like a very important thing to hit.

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先阅读 jupyterlab-manager 和 widgetsnbextension 如何处理 notebook 保存信号,然后跟踪 ipympl 为更新 mimebundle 而从前端到后端的路径。检查 PNG 情况下的 widget model 处理。完成的标准是:已保存的 widget state 能够渲染,而不是显示空白图形,并且渲染后的更新在保存 notebook 和执行 nbconvert 后仍然保留。

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

评估

技术栈
jupyter, jupyter-notebook
领域
backend, frontend
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

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