Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Bug]: Slow lasso selector over QuadMesh collection #22520

Copy link
Copy link
@Stassels

Description

@Stassels
Issue body actions

Bug summary

When I create pcolormesh plot with big enough data, lasso selector (useblit=True) is redrawing very slowly. Don't have problem with this in version 3.4.2

Code for reproduction

import numpy as np
from matplotlib.widgets import LassoSelector
import matplotlib.pyplot as plt

class SelectFromCollection:
    def __init__(self, ax):
        self.lasso = LassoSelector(ax, onselect=self.onselect, useblit=True)
    def onselect(self, verts):
        pass


if __name__ == '__main__':
    fig, ax = plt.subplots()

    np.random.seed(19680801)
    Z = np.random.rand(1095, 100)
    x = np.arange(-0.5, 100, 1)  # len = 11
    y = np.arange(4.5, 1100, 1)  # len = 7

    ax.pcolormesh(x, y, Z)
    # data2d = np.random.randint(0, 100,(1000,1000))
    # ax.imshow(data2d)
    selector = SelectFromCollection(ax)
    plt.show()

Actual outcome

Slow lasso drawing

Expected outcome

Quick lasso drawing :)

Additional information

If imshow is used, lasso selector is acting normaly.

Operating system

Ubuntu 20.04

Matplotlib Version

3.5.1

Matplotlib Backend

QtAgg

Python version

3.8

Jupyter version

No response

Installation

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.