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

Skip to content

Commit 2842536

Browse files
authored
Merge pull request #14418 from meeseeksmachine/auto-backport-of-pr-14285-on-v3.1.0-doc
Backport PR #14285 on branch v3.1.0-doc (DOC: add note to example about keeping hard-ref to SpanSelector)
2 parents 1dba133 + e75738d commit 2842536

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

examples/widgets/span_selector.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,17 @@ def onselect(xmin, xmax):
3838
ax2.set_ylim(thisy.min(), thisy.max())
3939
fig.canvas.draw()
4040

41-
# Set useblit=True on most backends for enhanced performance.
41+
#############################################################################
42+
# .. note
43+
#
44+
# If the SpanSelector object is garbage collected you will lose the
45+
# interactivity. You must keep a hard reference to it to prevent this.
46+
#
47+
48+
4249
span = SpanSelector(ax1, onselect, 'horizontal', useblit=True,
4350
rectprops=dict(alpha=0.5, facecolor='red'))
51+
# Set useblit=True on most backends for enhanced performance.
4452

4553

4654
plt.show()

0 commit comments

Comments
 (0)