Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e75738d

Browse filesBrowse files
timhoffmMeeseeksDev[bot]
authored andcommitted
Backport PR #14285: DOC: add note to example about keeping hard-ref to SpanSelector
1 parent 1dba133 commit e75738d
Copy full SHA for e75738d

File tree

Expand file treeCollapse file tree

1 file changed

+9
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-1
lines changed

‎examples/widgets/span_selector.py

Copy file name to clipboardExpand all lines: examples/widgets/span_selector.py
+9-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.