matplotlib / matplotlib/ipympl

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

Aperta
#391 16 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Jupyter Notebook
Stelle
1.7k
Fork
234
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

## 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](https://user-images.githubusercontent.com/7207093/141105912-278b891b-14fd-447a-8205-87e9851c0f64.png)

```
%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](https://user-images.githubusercontent.com/7207093/141107251-32aaa188-d6e9-4505-b8bb-0e8f539e4294.png)

---

No problem with `matplotlib`:

```
%matplotlib widget
import matplotlib.pyplot as plt

plt.plot([[1, 2], [0, 0]])
```
![image](https://user-images.githubusercontent.com/7207093/141106050-b2e8d6ba-0c58-4ff8-9d33-890909d06e1d.png)

## 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?

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo la heatmap di seaborn e il semplice grafico di matplotlib forniti in JupyterLab con `%matplotlib widget`, quindi confrontali con `%matplotlib inline`. Esamina l'integrazione di ipympl e dei widget Jupyter utilizzata da questa configurazione e verifica le versioni dei pacchetti elencate. L'attività è completata quando la heatmap di seaborn viene visualizzata interattivamente con il backend dei widget.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
jupyter-notebook, matplotlib, pandas, python
Ambito
data-visualization, frontend, tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.