You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
examples/widgets/span_selector.py is brittle #20200
examples/widgets/span_selector.py crashes if one clicks somewhere and immediately releases the click, without dragging the SpanSelector, with
Traceback (most recent call last):
File ".../matplotlib/lib/matplotlib/cbook/__init__.py", line 274, in process
func(*args, **kwargs)
File ".../matplotlib/lib/matplotlib/widgets.py", line 1840, in release
self._release(event)
File ".../matplotlib/lib/matplotlib/widgets.py", line 2069, in _release
self.onselect(vmin, vmax)
File ".../matplotlib/examples/widgets/span_selector.py", line 36, in onselect
ax2.set_xlim(region_x[0], region_x[-1])
IndexError: index 0 is out of bounds for axis 0 with size 0
Suggested Improvement
Make the example more robust.
Matplotlib version
Operating system: linux
Matplotlib version (import matplotlib; print(matplotlib.__version__)): 3.4+HEAD
Matplotlib documentation version (is listed under the logo): 3.4.2.post693
Activity
Jashshah6086 commentedon May 12, 2021
I would like to work on it.
anntzer commentedon May 12, 2021
It's yours.
Jashshah6086 commentedon May 12, 2021
#20212 (comment)
Why Error occured?
when pointer is not dragged list is either null or has null element.Which created error in indexing.
Solution:
Added condition on length of region_x
instead of
QuLogic commentedon May 17, 2021
Closed by #20212.