Skip to content

SpanSelector span_stays fails with use_blit=True #5680

Closed
@nedlrichards

Description

@nedlrichards

I am writing a really simply GUI to select an range of x values on a number of plots simultaneously. I would like the selection for each sub-plot to stay on the plot until the user has finished selected a span on each channel and exits the GUI.

The flag span_stays=True does not work with use_blit=True. It does work with use_blit=False. The performance hit isn't too bad as far as I can tell.

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

test_data = np.random.randn(1000, 1000)

fig, ax = plt.subplots()

ax.imshow(test_data)

def selection(x1, x2):
    """This function isn't the point"""
    pass

#uncommenting useblit makes span_stays stop working
span = SpanSelector(ax, selection, 'horizontal', #useblit=True,
                    rectprops=dict(alpha=0.5, facecolor='red'), span_stays=True)

plt.show()

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions