Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figures not automatically rendered in some cases #22

Open
xoolive opened this issue Oct 17, 2022 · 0 comments
Open

Figures not automatically rendered in some cases #22

xoolive opened this issue Oct 17, 2022 · 0 comments

Comments

@xoolive
Copy link

xoolive commented Oct 17, 2022

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant