matplotlib / matplotlib/ipympl

Partial or Glitchy Interactivity

Đang mở
#232 0 bình luận 0 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ả

Partial or Glitchy Interactivity

In my dev. environment, interactive figures:

  • fail to show resize handle, figure header and footer are never displayed
  • do not respect (but do not error) settings for:
    • fig.canvas.header_visible
    • fig.canvas.footer_visible
    • fig.canvas.resizable
  • completely disappear on mouse click or drag (no toolbar option selected) and never return on selecting toolbar Reset option
  • toolbar panning/zooming work fine
  • playing with figure.set_frameon(False) seems to cure the disappearing figure issue

My production environment (with [as far as I can tell] same versions) works as expected:

  • shows and respects resize handle, figure header and footer are displayed
  • respects settings for:
    • fig.canvas.header_visible
    • fig.canvas.footer_visible
    • fig.canvas.resizable
  • does not disappear on mouse click or drag (no toolbar option selected)
  • toolbar panning/zooming work fine

Both environments are using the classic notebook experience (not Lab), the biggest/most obvious difference being that production is a TLJH installation (i.e. JupyterHub spawning single-user notebooks), but all the notebook package versions across environments appear to be in sync (see below), so unless spawning affects things silently, I'd be surprised if that's the issue.

I've borrowed and executed this code (from https://github.com/matplotlib/ipympl/issues/203) as a test to make sure there's nothing wonky in my code and because it incorporates the ioff/ion pattern I'm reliant on:

%matplotlib widget
from IPython.display import display # this is automatically imported in the notebook anyway
from ipywidgets.widgets import HBox
import matplotlib.pyplot as plt
from scipy.misc import face

plt.ioff() # turn off interactive mode so figure doesn't show
fig1, ax1 = plt.subplots()
fig2, ax2 = plt.subplots()
plt.ion() # figure still doesn't show

ax1.imshow(face())
ax2.imshow(face(True))

display(HBox([fig1.canvas, fig2.canvas]))

Executing this code exhibits all of the issues I've described, i.e. it does not work (as described above) in development, but does work in production.

Versions

Development environment:
 3.6.9 (default, Jan 15 2020, 16:16:15) 
[GCC 6.3.0 20170516]
ipympl version: 0.5.6
jupyter core     : 4.6.3
jupyter-notebook : 6.0.3
qtconsole        : not installed
ipython          : 7.14.0
ipykernel        : 5.3.0
jupyter client   : 6.1.3
jupyter lab      : not installed
nbconvert        : 5.6.1
ipywidgets       : 7.5.1
nbformat         : 5.0.6
traitlets        : 4.3.3
Known nbextensions:
  config dir: /home/dschofield/.jupyter/nbconfig
    notebook section
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
  config dir: /home/dschofield/.local/share/virtualenvs/goldmine-hCKJOvFR/etc/jupyter/nbconfig
    notebook section
      jupyter-matplotlib/extension  enabled 
      - Validating: OK
      voila/extension  enabled 
      - Validating: OK
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
      qgrid/extension  enabled 
      - Validating: OK
JupyterLab v1.0.0
Known labextensions:
   app dir: /home/dschofield/.local/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v1.1.0  enabled  OK
        bqplot v0.5.1  enabled  OK
        ipyevents v1.7.0  enabled  OK
        ipysheet v0.4.3  enabled  OK
        ipytree v0.1.3  enabled  OK
        ipyvolume v0.5.2  enabled  OK
        jupyter-leaflet v0.11.4  enabled  OK
        jupyter-matplotlib v0.4.2  enabled  OK
        jupyter-threejs v2.1.1  enabled  OK
        jupyter-vue v1.0.0  enabled  OK
        jupyter-vuetify v1.1.1  enabled  OK
        jupyterlab-datawidgets v6.2.0  enabled  OK
        pywwt v0.7.0  enabled  OK
Production environment:
3.6.7 | packaged by conda-forge | (default, Feb 28 2019, 09:07:38) 
[GCC 7.3.0]
ipympl version: 0.5.6
jupyter core     : 4.6.3
jupyter-notebook : 6.0.3
qtconsole        : not installed
ipython          : 7.14.0
ipykernel        : 5.3.0
jupyter client   : 6.1.3
jupyter lab      : 1.2.5
nbconvert        : 5.6.1
ipywidgets       : 7.5.1
nbformat         : 5.0.6
traitlets        : 4.3.3
Known nbextensions:
  config dir: /opt/tljh/user/etc/jupyter/nbconfig
    notebook section
      jupyter-matplotlib/extension  enabled 
      - Validating: OK
      nbresuse/main  enabled 
      - Validating: OK
      voila/extension  enabled 
      - Validating: OK
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
      qgrid/extension  enabled 
      - Validating: OK
    tree section
      jupyter_server_proxy/tree  enabled 
      - Validating: OK
JupyterLab v1.2.5
Known labextensions:
   app dir: /opt/tljh/user/share/jupyter/lab
        @jupyter-widgets/jupyterlab-manager v1.1.0  enabled  OK
        jupyter-matplotlib v0.7.2  enabled  OK

I'm assuming that the differences in Lab extensions are not of concern here because I'm not using Lab, but before I go about testing that assumption, expert insight is welcomed.
Thanks in advance.

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 chạy bản tái hiện %matplotlib widget được cung cấp với các phiên bản development và production được liệt kê, sau đó so sánh các tiện ích mở rộng Notebook và các tiện ích mở rộng Lab được hiển thị trong báo cáo. Hoàn thành nghĩa là các hình tương tác vẫn giữ được header, footer, resize handle và các cài đặt hiển thị, đồng thời không còn biến mất sau khi tương tác bằng chuột hoặc Reset.

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, python
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 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.