|
8 | 8 | (for example, a matplotlib Line2D, Text, Patch, Polygon, AxesImage, |
9 | 9 | etc...) |
10 | 10 |
|
11 | | -There are a variety of meanings of the picker property |
| 11 | +There are a variety of meanings of the picker property: |
12 | 12 |
|
13 | | - None - picking is disabled for this artist (default) |
| 13 | +* *None* - picking is disabled for this artist (default) |
14 | 14 |
|
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. |
18 | 17 |
|
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 |
26 | 23 |
|
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. |
30 | 26 |
|
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) |
36 | 28 |
|
| 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. |
37 | 32 |
|
38 | 33 | After you have enabled an artist for picking by setting the "picker" |
39 | 34 | property, you need to connect to the figure canvas pick_event to get |
@@ -80,7 +75,7 @@ def pick_simple(): |
80 | 75 | fig, (ax1, ax2) = plt.subplots(2, 1) |
81 | 76 | ax1.set_title('click on points, rectangles or text', picker=True) |
82 | 77 | 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) |
84 | 79 |
|
85 | 80 | # pick the rectangle |
86 | 81 | ax2.bar(range(10), rand(10), picker=True) |
|
0 commit comments