rendering issues when exception is raised before cell execution completes

Open
#10 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
jupyter-notebook, matplotlib, python

Research direction

Reproduce the provided Python cell in the ipympl notebook integration using the reported Chrome environment, including the first run, raised exception, figure resize, and browser zoom levels. Compare the initial render with subsequent runs; done means the figure renders at the correct size and the zoom rectangle stays aligned after the exception without requiring a resize or rerun.

Written by the indexing model from the issue text.

Description

Reposting from jupyter/notebook issue. The code cell as appears in the screen shot is:

import ipympl
import matplotlib.pyplot as plt

def plot_something():
    plt.figure()
    plt.plot([0,2],[0,2],'-')
    plt.show()

plot_something()
raise Exception

The behavior I am seeing is different for the first time I run the cell and the next times. It is also different for different level of browser zoom levels (I am using Chrome 56.0.2924.87 on Windows 8.1)-

First time that the cell is run -
The figure appears but is not fully rendered (see image)-
notebook_matplotlib_exception_ipympl
If I then resize the figure using the GUI (bottom right corner), the behavior changes based on browser zoom level-

  1. When using 100% zoom level (default), the figure is rendered too small. When in this state the zoom rectangle is drawn offset from the mouse pointer. The zooming is determined by the mouse pointer, it is just the drawing of the rectangle that is off.
  2. When using 90% zoom level (ctrl^- once), the figure is rendered to size and the zoom rectangle is working fine.

When I rerun the cell the figure is re-rendered properly without need for resizing and independent of zoom level.

Dominant language
Jupyter Notebook
Stars
1.7k
Forks
234
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from matplotlib/ipympl

All issues in matplotlib/ipympl

Similar issues

More Data Visualization issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.