mpl.widgets.SpanSelector.__init__

SpanSelector.__init__(ax, onselect, direction, minspan=None, useblit=False, rectprops=None, onmove_callback=None, span_stays=False, button=None)[source]

Create a span selector in ax. When a selection is made, clear the span and call onselect with:

onselect(vmin, vmax)

and clear the span.

direction must be ‘horizontal’ or ‘vertical’

If minspan is not None, ignore events smaller than minspan

The span rectangle is drawn with rectprops; default:

rectprops = dict(facecolor='red', alpha=0.5)

Set the visible attribute to False if you want to turn off the functionality of the span selector

If span_stays is True, the span stays visble after making a valid selection.

button is a list of integers indicating which mouse buttons should be used for selection. You can also specify a single integer if only a single button is desired. Default is None, which does not limit which button can be used.

Note, typically:
1 = left mouse button 2 = center mouse button (scroll wheel) 3 = right mouse button