matplotlib / matplotlib/ipympl

Plot disappears after executing cell second time

Đang mở
#60 13 bình luận 9 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Jupyter Notebook
Star
1.7k
Fork
234
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện hai ví dụ về ô notebook trong JupyterLab và Jupyter Notebook với các backend widget và inline đã được báo cáo. So sánh việc thực thi lặp lại ô vẽ biểu đồ và xác nhận rằng biểu đồ dựa trên widget vẫn hiển thị và được render lại như mong đợi mà không cần thực thi lại ô chọn backend.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
jupyter-notebook, matplotlib, python
Lĩnh vực
data-visualization
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.