mne-tools / mne-tools/mne-python

RFC: plotting in notebooks with show=False

Open
#11,528 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Description

Many times (most recently in #11513) users complain / get confused about plot behavior in Jupyter Notebooks, specifically the problem of figures getting "shown" too early and having empty subplot axes (typically when pre-generating a figure w/ subplots and looping over the subplot axes). Most of our plotting functions have a show=False option which will prevent the problem, but the parameter name is really confusing and I don't think it's very well documented how it should be used/interpreted in a notebook context.

One possible option would be to change the parameter to something like delay_plotting=True so that its name better reflects what is common to notebooks and interactive console sessions --- namely that the figure won't be shown immediately when it's created. Obviously, removing show will break a lot of user code, so I'd be inclined to retain show as a @legacy alias for the new param (and warn or error if both params are provided?)

I invite other suggestions of how to address this problem.

cross-ref to #11165 where a lot of related discussion can be found

cc @sam-s

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.

Research direction

Start by reading the related discussions in #11165 and #11513, then inspect the plotting functions that expose the show=False option. Done requires an agreed API and clear notebook behavior, including how any legacy alias or conflicting parameters should be handled.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.