matplotlib / matplotlib/matplotlib

[ENH]: Add multiple span selector

Open
#28,484 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

New feature topic: widgets/UI
Dominant language
Python
Stars
23.2k
Forks
8.5k
Avg merge
1d 6h
Merged PRs (30d)
66

Description

### Problem

`matplotlib.widgets.SpanSelector` is a useful widget, however only supports one span to be created because of how the class functionality tracks movement and positioning on a screen.

### Proposed solution

Would there be interest in an `NSpanSelector`, which would generalize SpanSelector to N many spans controlled by a single object?
I've written a demo for `NSpanSelector` which is subclass of `SpanSelector`, that corrects the handling functionality for multiple spans. I haven't contributed to many open source projects before. I'm not sure if something like this would even be wanted by others - I had a particular use case where two selectors were needed simultaneously. But since I've written it I'm happy to contribute it!

Here's a snapshot of my example implementation.
![image](https://github.com/matplotlib/matplotlib/assets/2296818/91aa4be4-47f2-409e-8726-c6465d2e92e9)

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 reviewing matplotlib.widgets.SpanSelector and the proposed NSpanSelector demo described in the issue. Before implementation, clarify whether a multi-span API is wanted, its interaction model, and the tests or examples that would define completion.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.