Figures not automatically rendered in some cases

Open
#22 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start by reproducing the two-cell example in a fresh Jupyter kernel, comparing the inline rendering behavior with and without the style context and DateFormatter. Trace the rendering path after the first cell; done means figures created in subsequent cells are rendered normally.

Written by the indexing model from the issue text.

Description

I found that in a fresh Jupyter kernel, the following snippet prevents further figures to be rendered:

# cell 1
import matplotlib.pyplot as plt
from matplotlib.dates import DateFormatter

with plt.style.context('seaborn'):
    fig, ax = plt.subplots(figsize=(5, 5))
    ax.xaxis.set_major_formatter(DateFormatter("%H:%M"))

This figure ("cell 1") is rendered, but new figures are not rendered any more in a notebook:

# cell 2
fig, ax = plt.subplots(figsize=(5, 5))  # not rendered

The issue does not appear in any of the following case:

  • "cell 2" is run before "cell 1": all following figures are then properly rendered
  • The %matplotlib inline instruction is explicitly added, before or after "cell 1"
  • The context manager is not used (but it fails with any stylesheet)
  • The DateFormatter is not applied
Dominant language
Jupyter Notebook
Stars
31
Forks
39
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

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 ipython/matplotlib-inline

All issues in ipython/matplotlib-inline

Similar issues

More Data Visualization issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.