Skip to content

Commit e6ab691

Browse files
committed
fix typos and unused imports in ex/event_handling
1 parent 5c0d2bf commit e6ab691

10 files changed

+21
-29
lines changed

examples/event_handling/data_browser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class PointBrowser:
55
"""
66
Click on a point to select and highlight it -- the data that
77
generated the point will be shown in the lower axes. Use the 'n'
8-
and 'p' keys to browse through the next and pervious points
8+
and 'p' keys to browse through the next and previous points
99
"""
1010
def __init__(self):
1111
self.lastind = 0

examples/event_handling/lasso_demo.py

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
inside polygon detection routine.
99
"""
1010
from matplotlib.widgets import Lasso
11-
import matplotlib.mlab
1211
from matplotlib.nxutils import points_inside_poly
1312
from matplotlib.colors import colorConverter
1413
from matplotlib.collections import RegularPolyCollection

examples/event_handling/legend_picking.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
def onpick(event):
3030
# on the pick event, find the orig line corresponding to the
31-
# legend proxy line, and toggle the visibilit
31+
# legend proxy line, and toggle the visibility
3232
legline = event.artist
3333
origline = lined[legline]
3434
vis = not origline.get_visible()

examples/event_handling/path_editor.py

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import matplotlib.path as mpath
33
import matplotlib.patches as mpatches
44
import matplotlib.pyplot as plt
5-
import matplotlib.mlab as mlab
65

76
Path = mpath.Path
87

examples/event_handling/pick_event_demo.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
"""
44
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,
77
etc...)
88
99
There are a variety of meanings of the picker property
@@ -15,27 +15,27 @@
1515
the artist
1616
1717
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
1919
off an event if it's data is within epsilon of the mouse
2020
event. For some artists like lines and patch collections,
2121
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
2323
epsilon of the pick event
2424
25-
function - if picker is callable, it is a user supplied
25+
function - if picker is callable, it is a user supplied
2626
function which determines whether the artist is hit by the
2727
mouse event.
2828
2929
hit, props = picker(artist, mouseevent)
3030
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
3232
artist, return hit=True and props is a dictionary of properties
3333
you want added to the PickEvent attributes
3434
3535
3636
After you have enabled an artist for picking by setting the "picker"
3737
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,
3939
4040
def pick_handler(event):
4141
mouseevent = event.mouseevent
@@ -47,9 +47,9 @@ def pick_handler(event):
4747
your callback is always fired with two attributes:
4848
4949
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
5353
which buttons were pressed, which keys were pressed, which Axes
5454
the mouse is over, etc. See matplotlib.backend_bases.MouseEvent
5555
for details.
@@ -58,8 +58,8 @@ def pick_handler(event):
5858
5959
Additionally, certain artists like Line2D and PatchCollection may
6060
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)
6363
6464
The examples below illustrate each of these methods.
6565
"""

examples/event_handling/pick_event_demo2.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
2-
compute the mean and stddev of 100 data sets and plot mean vs stddev.
3-
When you click on one of the mu, sigma points, plot the raw data from
4-
the dataset that generated the mean and stddev
2+
compute the mean and standard deviation (stddev) of 100 data sets and plot
3+
mean vs stddev. When you click on one of the mu, sigma points, plot the raw
4+
data from the dataset that generated the mean and stddev.
55
"""
66
import numpy
77
import matplotlib.pyplot as plt
@@ -31,7 +31,7 @@ def onpick(event):
3131
ax.plot(X[dataind])
3232
ax.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f'%(xs[dataind], ys[dataind]),
3333
transform=ax.transAxes, va='top')
34-
ax.set_ylim(-0.5, 1.5)
34+
ax.set_ylim(-0.5, 1.5)
3535
figi.show()
3636
return True
3737

examples/event_handling/pipong.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python
22
# A matplotlib based game of Pong illustrating one way to write interactive
3-
# animation which are easily ported to multiply backends
3+
# animation which are easily ported to multiple backends
44
# pipong.py was written by Paul Ivanov <http://pirsquared.org>
55

66
from __future__ import print_function

examples/event_handling/pong_gtk.py

-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
import matplotlib
1313
matplotlib.use('GTKAgg')
1414

15-
import numpy as np
1615
import matplotlib.pyplot as plt
1716
import pipong
18-
from numpy.random import randn, randint
1917

2018

2119
fig = plt.figure()

examples/event_handling/pong_qt.py

-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from __future__ import print_function
55

6-
import os, sys
76
import matplotlib
87
matplotlib.use('QtAgg') # qt3 example
98

@@ -16,12 +15,9 @@
1615
FALSE = 0
1716
ITERS = 1000
1817

19-
import pylab as p
2018
import matplotlib.pyplot as plt
21-
import numpy as np
2219
import time
2320
import pipong
24-
from numpy.random import randn, randint
2521

2622
class BlitQT(QObject):
2723
def __init__(self):

examples/event_handling/zoom_window.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""
2-
This example shows how to connect events in one window, eg a mouse
2+
This example shows how to connect events in one window, for example, a mouse
33
press, to another figure window.
44
55
If you click on a point in the first window, the z and y limits of the
66
second will be adjusted so that the center of the zoom in the second
7-
window will be the x,y coords of the clicked point.
7+
window will be the x,y coordinates of the clicked point.
88
99
Note the diameter of the circles in the scatter are defined in
1010
points**2, so their size is independent of the zoom

0 commit comments

Comments
 (0)