10000 DOC: Don't use deprecated picker=Numeric. · matplotlib/matplotlib@ad8a40e · GitHub
[go: up one dir, main page]

Skip to content

Commit ad8a40e

Browse files
committed
DOC: Don't use deprecated picker=Numeric.
1 parent f722ea1 commit ad8a40e

File tree

3 files changed

+18
-23
lines changed

3 files changed

+18
-23
lines changed

examples/event_handling/data_browser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def update(self):
9191

9292
fig, (ax, ax2) = plt.subplots(2, 1)
9393
ax.set_title('click on point to plot time series')
94-
line, = ax.plot(xs, ys, 'o', picker=5) # 5 points tolerance
94+
line, = ax.plot(xs, ys, 'o', picker=True, pickradius=5)
9595

9696
browser = PointBrowser()
9797

examples/event_handling/pick_event_demo.py

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,27 @@
88
(for example, a matplotlib Line2D, Text, Patch, Polygon, AxesImage,
99
etc...)
1010
11-
There are a variety of meanings of the picker property
11+
There are a variety of meanings of the picker property:
1212
13-
None - picking is disabled for this artist (default)
13+
* *None* - picking is disabled for this artist (default)
1414
15-
boolean - if True then picking will be enabled and the
16-
artist will fire a pick event if the mouse event is over
17-
the artist
15+
* bool - if *True* then picking will be enabled and the artist will fire a pick
16+
event if the mouse event is over the artist.
1817
19-
float - if picker is a number it is interpreted as an
20-
epsilon tolerance in points and the artist will fire
21-
off an event if it's data is within epsilon of the mouse
22-
event. For some artists like lines and patch collections,
23-
the artist may provide additional data to the pick event
24-
that is generated, for example, the indices of the data within
25-
epsilon of the pick event
18+
Setting ``pickradius`` will add an epsilon tolerance in points and the artist
19+
will fire off an event if its data is within epsilon of the mouse event. For
20+
some artists like lines and patch collections, the artist may provide
21+
additional data to the pick event that is generated, for example, the indices
22+
of the data within epsilon of the pick event
2623
27-
function - if picker is callable, it is a user supplied
28-
function which determines whether the artist is hit by the
29-
mouse event.
24+
* function - if picker is callable, it is a user supplied function which
25+
determines whether the artist is hit by the mouse event.
3026
31-
hit, props = picker(artist, mouseevent)
32-
33-
to determine the hit test. If the mouse event is over the
34-
artist, return hit=True and props is a dictionary of properties
35-
you want added to the PickEvent attributes
27+
hit, props = picker(artist, mouseevent)
3628
29+
to determine the hit test. If the mouse event is over the artist, return
30+
hit=True and props is a dictionary of properties you want added to the
31+
PickEvent attributes.
3732
3833
After you have enabled an artist for picking by setting the "picker"
3934
property, you need to connect to the figure canvas pick_event to get
@@ -80,7 +75,7 @@ def pick_simple():
8075
fig, (ax1, ax2) = plt.subplots(2, 1)
8176
ax1.set_title('click on points, rectangles or text', picker=True)
8277
ax1.set_ylabel('ylabel', picker=True, bbox=dict(facecolor='red'))
83-
line, = ax1.plot(rand(100), 'o', picker=5) # 5 points tolerance
78+
line, = ax1.plot(rand(100), 'o', picker=True, pickradius=5)
8479

8580
# pick the rectangle
8681
ax2.bar(range(10), rand(10), picker=True)

examples/event_handling/pick_event_demo2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
fig, ax = plt.subplots()
1919
ax.set_title('click on point to plot time series')
20-
line, = ax.plot(xs, ys, 'o', picker=5) # 5 points tolerance
20+
line, = ax.plot(xs, ys, 'o', picker=True, pickradius=5)
2121

2222

2323
def onpick(event):

0 commit comments

Comments
 (0)
0