2
2
3
3
"""
4
4
5
- You can enable picking by setting the"picker" property of an artist
6
- (eg a matplotlib Line2D, Text, Patch, Polygon, AxesImage,
5
+ You can enable picking by setting the "picker" property of an artist
6
+ (for example, a matplotlib Line2D, Text, Patch, Polygon, AxesImage,
7
7
etc...)
8
8
9
9
There are a variety of meanings of the picker property
15
15
the artist
16
16
17
17
float - if picker is a number it is interpreted as an
18
- epsilon tolerance in points and the the artist will fire
18
+ epsilon tolerance in points and the artist will fire
19
19
off an event if it's data is within epsilon of the mouse
20
20
event. For some artists like lines and patch collections,
21
21
the artist may provide additional data to the pick event
22
- that is generated, eg the indices of the data within
22
+ that is generated, for example, the indices of the data within
23
23
epsilon of the pick event
24
24
25
- function - if picker is callable, it is a user supplied
25
+ function - if picker is callable, it is a user supplied
26
26
function which determines whether the artist is hit by the
27
27
mouse event.
28
28
29
29
hit, props = picker(artist, mouseevent)
30
30
31
- to determine the hit test. if the mouse event is over the
31
+ to determine the hit test. If the mouse event is over the
32
32
artist, return hit=True and props is a dictionary of properties
33
33
you want added to the PickEvent attributes
34
34
35
35
36
36
After you have enabled an artist for picking by setting the "picker"
37
37
property, you need to connect to the figure canvas pick_event to get
38
- pick callbacks on mouse press events. Eg ,
38
+ pick callbacks on mouse press events. For example ,
39
39
40
40
def pick_handler(event):
41
41
mouseevent = event.mouseevent
@@ -47,9 +47,9 @@ def pick_handler(event):
47
47
your callback is always fired with two attributes:
48
48
49
49
mouseevent - the mouse event that generate the pick event. The
50
- mouse event in turn has attributes like x and y (the coords in
51
- display space, eg pixels from left, bottom) and xdata, ydata (the
52
- coords in data space). Additionaly , you can get information about
50
+ mouse event in turn has attributes like x and y (the coordinates in
51
+ display space, such as pixels from left, bottom) and xdata, ydata (the
52
+ coords in data space). Additionally , you can get information about
53
53
which buttons were pressed, which keys were pressed, which Axes
54
54
the mouse is over, etc. See matplotlib.backend_bases.MouseEvent
55
55
for details.
@@ -58,8 +58,8 @@ def pick_handler(event):
58
58
59
59
Additionally, certain artists like Line2D and PatchCollection may
60
60
attach additional meta data like the indices into the data that meet
61
- the picker criteria (eg all the points in the line that are within the
62
- specified epsilon tolerance)
61
+ the picker criteria (for example, all the points in the line that are within
62
+ the specified epsilon tolerance)
63
63
64
64
The examples below illustrate each of these methods.
65
65
"""
0 commit comments