Discussion:
[Matplotlib-users] SpanSelector span_stays does not work for me
Edward Richards
2015-12-12 00:48:56 UTC
Permalink
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 mouse.

Any help is appreciated.
Thanks,
Ned

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.
print(matplotlib.__version__)
1.5.0

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()
ax.imshow(test_data)

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

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


------------------------------------------------------------------------------
Benjamin Root
2015-12-14 20:50:39 UTC
Permalink
Have you tried setting "useblit=False"? If that works, I wonder if we
accidentally broke something in the recent widget interactivity work...


Ben Root
Post by Edward Richards
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 mouse.
Any help is appreciated.
Thanks,
Ned
My backend is 'TkAgg'
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.
print(matplotlib.__version__)
1.5.0
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)
"""This function isn't the point"""
pass
span = SpanSelector(ax, selection, 'horizontal', useblit=True,
rectprops=dict(alpha=0.5, facecolor='red'), span_stays=True)
plt.show()
------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Loading...