[Matplotlib-users] SpanSelector span_stays does not work for me

Edward Richards edwardlrichards at gmail.com
Mon Dec 14 17:23:57 EST 2015

I sent the original message to the source forge mailing list. Woops. 
Thanks for the response anyways.

The span stays highlighted when I set useblit=False. The performance hit 
isn't too bad, and I will stay with this option for the moment.

*** Response ***

Have you tried setting "useblit=False"? If that works, I wonder if we 
accidentally broke something in the recent widget interactivity work...

Ben Root

*** Original Message ***

I am selecting a region of a color plot with span selector, and I would 
like the selected region to stay highlighted. I found the span_stays 
flag, but the selection rectangle still disappears after I release the 

Any help is appreciated.

My backend is 'TkAgg'

I am running the script from python3.4 at the command line, my version is:

Python 3.4.3 (default, Jun 19 2015, 05:46:30)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.


code example:

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()

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

span = SpanSelector(ax, selection, 'horizontal', useblit=True,
                     rectprops=dict(alpha=0.5, facecolor='red'), 

More information about the Matplotlib-users mailing list