matplotlib / matplotlib/ipympl

Blank figures in Jupyter notebook

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

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

bug
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ả

I have happily used interactive plots in jupyter notebooks for years with %matplotlib notebook. Unfortunately, since version 7 was introduced, I have experienced troubles with getting interactive plotting to work properly. I read that version 7 requires installing ipympl and %matplotlib ipympl.

Today, I set up a fresh virtual environment and installed jupyter and ipympl. Figures are opening, the controls appear, a figure title appears, but the figure contains no content. There is also no error message on the browser's developer console.

Steps to reproduce:

# Create virtual environment
python3 -m venv debug
source debug/bin/activate

# Install jupyter and ipympl
pip install jupyter ipympl matplotlib numpy

# Open notebook
jupyter notebook

Then I use the code from the basic example

%matplotlib ipympl
import matplotlib.pyplot as plt
import numpy as np

fig, ax = plt.subplots()
x = np.linspace(0, 2*np.pi, 100)
y = np.sin(3*x)
ax.plot(x, y)

A white area is opening, the controls appear, but there is no figure content.

I have seen several similar issues on Stackoverflow, where the solution is usually to upgrade or downgrade one of the packages. However, these answers have aged as newer versions came out in the meantime. Is there a general recipe to identify the issue when interactive plotting fails?

Versions

Python: 3.12.3
ipympl version: 0.9.4
IPython          : 8.25.0
ipykernel        : 6.29.4
ipywidgets       : 8.1.3
jupyter_client   : 8.6.2
jupyter_core     : 5.7.2
jupyter_server   : 2.14.1
jupyterlab       : 4.2.1
nbclient         : 0.10.0
nbconvert        : 7.16.4
nbformat         : 5.10.4
notebook         : 7.2.0
qtconsole        : 5.5.2
traitlets        : 5.14.3
jupyter labextension list 
JupyterLab v4.2.1
/home/bene/local/venvs/debug/share/jupyter/labextensions
        jupyterlab_pygments v0.3.0 enabled OK (python, jupyterlab_pygments)
        jupyter-matplotlib v0.11.4 enabled OK
        @jupyter-widgets/jupyterlab-manager v5.0.11 enabled OK (python, jupyterlab_widgets)
        @jupyter-notebook/lab-extension v7.2.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

Tái hiện hình trống bằng các lệnh môi trường ảo được liệt kê và ví dụ cơ bản của ipympl. Trước tiên, hãy kiểm tra các phiên bản Python, JupyterLab, notebook, ipympl và widget được báo cáo, cùng với khả năng tương thích của chúng. Hoàn thành có nghĩa là xác định nguyên nhân và ghi lại một phương pháp chẩn đoán đáng tin cậy hoặc cách khắc phục bằng phiên bản gói cho các hình tương tác.

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, jupyter-notebook, python
Lĩnh vực
data-visualization, frontend
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/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.