Thanks to visit codestin.com
Credit goes to github.com

Skip to content

No good way to disable SpanSelector #7009

Closed
@LindyBalboa

Description

@LindyBalboa

1.5.1 Python3.5

So it seems SpanSelector has no built in method to shut down. The docs say "For the selector to remain responsive you must keep a reference to it." but even without a reference, the behavior persists. I attempted doing a del spanSelector but the behavior persisted.

The docs suggest doing spanSelector.set_visible(False) but in order to turn it back on again, one must use spanSelector.set_visible(True). This automatically shows the last selected span, which is probably not a desirable default behavior.

from matplotlib import pyplot as plt
import matpltotlib

ax = plt.subplot(111)
def onSelect(m,n):
    print(m,n)
s = matplotlib.widgets.SpanSelector(ax, onSelect, 'horizontal')
s.set_visible(False)
s.set_visible(True)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions