matplotlib / matplotlib/ipympl

No heatmap shown with `seaborn` and `%matplotlib widget`

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

还没有人认领这个 Issue。

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

描述

Describe the issue

Thank you very much for providing this tool!

I have an apparently seaborn-related problem with showing widgets; I am posting this here first. Please let me know if you think this problem is rather on seaborn's end and I'll repost it there.


The problem: seaborn figures are not shown in JupyterLab with %matplotlib widget (they do show up with %matplotlib inline):

%matplotlib widget
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns

df = pd.DataFrame([[10, 20, 30, 40], [50, 30, 8, 15],
                   [25, 14, 41, 8], [7, 14, 21, 28]])
sns.heatmap(df, cmap='RdYlGn', linewidths=0.30, annot=True)

image

%matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns

df = pd.DataFrame([[10, 20, 30, 40], [50, 30, 8, 15],
                   [25, 14, 41, 8], [7, 14, 21, 28]])
sns.heatmap(df, cmap='RdYlGn', linewidths=0.30, annot=True)

image


No problem with matplotlib:

%matplotlib widget
import matplotlib.pyplot as plt

plt.plot([[1, 2], [0, 0]])

image

Versions

ipympl version: 0.8.2
Selected Jupyter core packages...
IPython          : 7.29.0
ipykernel        : 6.4.2
ipywidgets       : 7.6.5
jupyter_client   : 7.0.6
jupyter_core     : 4.9.1
jupyter_server   : 1.11.2
jupyterlab       : 3.2.2
nbclient         : 0.5.5
nbconvert        : 6.2.0
nbformat         : 5.1.3
notebook         : 6.4.5
qtconsole        : not installed
traitlets        : 5.1.1
Known nbextensions:
  config dir: /home/dominique/.jupyter/nbconfig
    notebook section
      nbextensions_configurator/config_menu/main  enabled 
      - Validating: problems found:
        - require?  X nbextensions_configurator/config_menu/main
      contrib_nbextensions_help_item/main  enabled 
      - Validating: OK
      spellchecker/main  enabled 
      - Validating: OK
      gist_it/main  enabled 
      - Validating: OK
    tree section
      nbextensions_configurator/tree_tab/main  enabled 
      - Validating: problems found:
        - require?  X nbextensions_configurator/tree_tab/main
  config dir: /home/dominique/.local/miniconda/envs/test/etc/jupyter/nbconfig
    notebook section
      jupyter-matplotlib/extension  enabled 
      - Validating: OK
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
JupyterLab v3.2.2
/home/dominique/.local/miniconda/envs/test/share/jupyter/labextensions
        jupyter-matplotlib v0.10.2 enabled OK
        @jupyter-widgets/jupyterlab-manager v3.0.1 enabled OK (python, jupyterlab_widgets)

Installed from conda-forge

mamba create -n test matplotlib pandas seaborn jupyterlab ipympl -y -c conda-forge

More versions:

# Name                    Version                   Build  Channel
matplotlib                3.4.3            py39hf3d152e_1    conda-forge
matplotlib-base           3.4.3            py39h2fa2bec_1    conda-forge
matplotlib-inline         0.1.3              pyhd8ed1ab_0    conda-forge
pandas                    1.3.4            py39hde0f152_1    conda-forge
seaborn                   0.11.2               hd8ed1ab_0    conda-forge
seaborn-base              0.11.2             pyhd8ed1ab_0    conda-forge

Do you have an idea why this is happening?

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先,在 JupyterLab 中使用 %matplotlib widget 重现所提供的 seaborn 热力图和简单的 matplotlib 绘图,然后将它们与 %matplotlib inline 进行比较。检查此设置所使用的 ipympl 和 Jupyter widget 集成,并验证列出的软件包版本。当 seaborn 热力图能够通过 widget backend 进行交互式渲染时,即表示完成。

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

评估

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

把新 issue 发到你的邮箱

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