matplotlib / matplotlib/matplotlib

[ENH]: Plot overlay

Open
#30,953 24 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

### Problem

One limiting factor of interactivity in Matplotlib is that we draw almost all visual elements via Artists onto the figure. This has poor performance for fast changing elements like crosshair cursors, because we always have to redraw the complete figure (or try to fiddle with blitting).

### Proposed solution

The fundamental solution idea here is to pull such elements out of the actual figure and instead overlay them on the not-changing figure image.

This is currently in a very early idea stage.

**What can be achieved with this**
Interactivity with fast changing elments such as:
- Zoom box (already implemented as a special case)
- Crosshair cursors (see also #30516).
- Tooltips
- Selectors

**What still won't be possible**
Dynamically changing plot properties like greying out data depending on a selector like https://docs.bokeh.org/en/latest/docs/examples/interaction/linking/linked_brushing.html.

**What would be needed**
- A concept of overlays. This could be:
a) GUI specific, e.g. we define a set of native primitives (lines, rectangles, maybe semantic ones like CrosshairCursor, similar to artists) that are drawn by the canvas on top of the actual figure image. This requires implementing of the primitives in all backends and will provide the fastest rendering.
b) Create the concept of an "overlay figure" that uses our exising rendering mechanisms to create a (mostly transparent) full image that is drawn on top of the existing figure image.

- Some mapping and event logic, so e.g. that the overlay can draw a line across a complete Axes, or get tooltip information for the current coordinate.

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 proposed overlay approaches in this issue and the related crosshair-cursor issue #30516. No files, tests, or entry points are named, and the issue is still at an early idea stage. A contribution would need a decided overlay design, mapping and event requirements, and a defined implementation scope.

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
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.