matplotlib / matplotlib/ipympl
Plot disappears after executing cell second time
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Jupyter Notebook
- Estrellas
- 1.7k
- Forks
- 234
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
If I have a plot in a notebook cell, and execute it twice, the plot output disappears. This is not what is expected. For example, using this code in one jupyter notebook cell:
```
%matplotlib widget
import matplotlib.pyplot as plt
```
and this in another cell:
```
x = [0, 1, 2, 3]
y = [0, 1, 2, 3]
plt.plot(x, y)
```
The first time I run this, everything plots fine. But when I execute the second cell twice (or any following calls), the plot disappears. The expected behaviour is that it re-plots (using a different colour). If I then re-run the first cell (with `%matplotlib widget`), and then the second cell again, it works (but this basically just resets the plot).
If I include a plot command in the first cell, then I can re-run the second cell as many times as I want and it works as expected.
This does not happen if I use `%matplotlib inline`. I've tested in both jupyter lab and jupyter notebook. My versions are the following:
```
matplotlib 2.2.2 py36_1 conda-forge
ipympl 0.2.1 py36_0 conda-forge
@jupyter-widgets/jupyterlab-manager
@jupyter-widgets/jupyterlab-manager v0.35.0 enabled OK
```
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Empieza reproduciendo los dos ejemplos de celdas de notebook en JupyterLab y Jupyter Notebook con los backends widget e inline indicados. Compara la ejecución repetida de la celda de trazado y confirma que el trazado basado en widget permanece visible y se vuelve a renderizar como se espera sin volver a ejecutar la celda de selección del backend.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- jupyter-notebook, matplotlib, python
- Área
- data-visualization
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100