ipython / ipython/matplotlib-inline

Figures not automatically rendered in some cases

未关闭
#22 0 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Jupyter Notebook
星标
31
派生
39
PR 合并指标
30 天内没有已合并 PR

描述

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

```python
# 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:

```python
# 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

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。