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

Skip to content

Commit 86acc0c

Browse files
authored
Merge pull request #20241 from meeseeksmachine/auto-backport-of-pr-20212-on-v3.4.x
Backport PR #20212 on branch v3.4.x (Update span_selector.py)
2 parents de18beb + 3693d1d commit 86acc0c

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

examples/widgets/span_selector.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ def onselect(xmin, xmax):
3232

3333
region_x = x[indmin:indmax]
3434
region_y = y[indmin:indmax]
35-
line2.set_data(region_x, region_y)
36-
ax2.set_xlim(region_x[0], region_x[-1])
37-
ax2.set_ylim(region_y.min(), region_y.max())
38-
fig.canvas.draw()
35+
36+
if len(region_x) >= 2:
37+
line2.set_data(region_x, region_y)
38+
ax2.set_xlim(region_x[0], region_x[-1])
39+
ax2.set_ylim(region_y.min(), region_y.max())
40+
fig.canvas.draw()
3941

4042
#############################################################################
4143
# .. note::

0 commit comments

Comments
 (0)