ENH: Adding a scale legend to plot_topo and other plotting functions

Open
#9,303 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
matplotlib, python

Research direction

Start by reading the plot_topo entry point and the related plot_evoked_topo and plot_topo_image_epochs functions to understand their unified subplot behavior. Define the scale legend's scope, placement, and interaction for each channel type before implementing; done should include legends that accurately describe the subplot scales across the targeted plotting functions.

Written by the indexing model from the issue text.

Description

ENH VIZ
Describe the new feature or enhancement

Plotting functions like plot_topo could use a scale legend to visually describe the exact scale of subplots being represented by each subplot. Something like this :

WhatsApp Image 2021-04-13 at 23 01 00

The proposed scale legend showcases the X and Y scale used by each channel type in the initial plot and also the scale for each subplot on click. The parameter could also take an input to customize where the scale legend is located with inputs such as (Left and Right) or custom location parameters.

This would potentially be a multi PR approach with the initial focus specifically for plot_topo and its different forms such as plot_evoked_topo, plot_topo_image_epochs etc.

Describe your proposed implementation

One way of implementing this would be to add the Scale Legend as a separate subplot for each channel type with specifically mapped default locations. Since plot_topo currently only works with unified=True, this would be the easiest way to implement it. This does mean a new Scale_Legend class is created in the process.

Describe possible alternatives

Another potential method is to work with a custom class created from matplotlib.legend. This does bring a unique set of complications based on how it interacts with unified=True inside plot_topo and the subplots as well. Theoretically, this method would be easier to maintain, although since it's still a custom child class it wouldn't differ by much.

Thoughts? @larsoner @agramfort @jasmainak @drammock @rob-luke

References:

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

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 mne-tools/mne-python

All issues in mne-tools/mne-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.