Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 71c720b

Browse files
committed
Merged revisions 7536,7541 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint ........ r7536 | jdh2358 | 2009-08-23 00:27:40 -0500 (Sun, 23 Aug 2009) | 1 line fix some typos in the docs ........ r7541 | jdh2358 | 2009-08-23 13:42:37 -0500 (Sun, 23 Aug 2009) | 1 line more harness around locale ........ svn path=/trunk/matplotlib/; revision=7542
2 parents f8cb64e + 6be06d2 commit 71c720b

8 files changed

Lines changed: 84 additions & 26 deletions

File tree

doc/users/annotations_guide.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Annotating Axes
55
****************
66

7-
Do not proceed unless you already have read
7+
Do not proceed unless you already have read
88
:func:`~matplotlib.pyplot.text` and :func:`~matplotlib.pyplot.annotate`!
99

1010

@@ -38,7 +38,7 @@ method. ::
3838
bb.set_boxstyle("rarrow", pad=0.6)
3939

4040
The arguments are the name of the box style with its attributes as
41-
keyword arguments. Currently, followign box styles are implemented.
41+
keyword arguments. Currently, following box styles are implemented.
4242

4343
========== ============== ==========================
4444
Class Name Attrs
@@ -55,7 +55,7 @@ keyword arguments. Currently, followign box styles are implemented.
5555
.. plot:: mpl_examples/pylab_examples/fancybox_demo2.py
5656

5757

58-
Note that the attrubutes arguments can be specified within the style
58+
Note that the attributes arguments can be specified within the style
5959
name with separating comma (this form can be used as "boxstyle" value
6060
of bbox argument when initializing the text instance) ::
6161

@@ -103,7 +103,7 @@ The arrow drawing takes a few steps.
103103
2. If patch object is given (*patchA* & *patchB*), the path is clipped to
104104
avoid the patch.
105105

106-
3. The path is further shrinked by given amount of pixels (*shirnkA*
106+
3. The path is further shrunk by given amount of pixels (*shirnkA*
107107
& *shrinkB*)
108108

109109
4. The path is transmuted to arrow patch, which is controlled by the
@@ -114,7 +114,7 @@ The arrow drawing takes a few steps.
114114

115115

116116
The creation of the connecting path between two points is controlled by
117-
``connectionstyle`` key and follwing styles are available.
117+
``connectionstyle`` key and following styles are available.
118118

119119
========== =============================================
120120
Name Attrs
@@ -197,7 +197,7 @@ axes. ::
197197
ax2.add_artist(con)
198198

199199
The above code connects point xy in data coordinate of ``ax1`` to
200-
point xy int data coordiante of ``ax2``. Here is a simple example.
200+
point xy int data coordinate of ``ax2``. Here is a simple example.
201201

202202
.. plot:: users/plotting/examples/connect_simple01.py
203203

@@ -230,7 +230,7 @@ available in ``mpl_toolkits.axes_grid.anchored_artists``. ::
230230
The *loc* keyword has same meaning as in the legend command.
231231

232232
A simple application is when the size of the artist (or collection of
233-
artists) is knwon in pixel size during the time of creation. For
233+
artists) is known in pixel size during the time of creation. For
234234
example, If you want to draw a circle with fixed size of 20 pixel x 20
235235
pixel (radius = 10 pixel), you can utilize
236236
``AnchoredDrawingArea``. The instance is created with a size of the
@@ -280,15 +280,15 @@ legend (as a matter of fact, this is how the legend is created).
280280
.. plot:: users/plotting/examples/anchored_box04.py
281281

282282
Note that unlike the legend, the ``bbox_transform`` is set
283-
to IdentityTransform by default.
283+
to IdentityTransform by default.
284284

285285
Advanced Topics
286286
***************
287287

288288
Zoom effect between Axes
289289
========================
290290

291-
mpl_toolkits.axes_grid.inset_locator defines some patch classs useful
291+
mpl_toolkits.axes_grid.inset_locator defines some patch classes useful
292292
for interconnect two axes. Understanding the code requires some
293293
knowledge of how mpl's transform works. But, utilizing it will be
294294
straight forward.
@@ -327,6 +327,6 @@ matplotlib.patches.BoxStyle._Base as demonstrated below.
327327
:include-source:
328328

329329

330-
Similarly, you can define custom ConnectionStyle and Custome ArrowStyle.
330+
Similarly, you can define custom ConnectionStyle and custom ArrowStyle.
331331
See the source code of ``lib/matplotlib/patches.py`` and check
332332
how each style class is defined.

doc/users/event_handling.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Event handling and picking
55
**************************
66

77
matplotlib works with 6 user interface toolkits (wxpython, tkinter,
8-
qt, gtk, fltk abd macosx) and in order to support features like interactive
8+
qt, gtk, fltk and macosx) and in order to support features like interactive
99
panning and zooming of figures, it is helpful to the developers to
1010
have an API for interacting with the figure via key presses and mouse
1111
movements that is "GUI neutral" so we don't have to repeat a lot of
@@ -150,7 +150,7 @@ Draggable rectangle exercise
150150

151151
Write draggable rectangle class that is initialized with a
152152
:class:`~matplotlib.patches.Rectangle` instance but will move its x,y
153-
location when dragged. Hint: you will need to store the orginal
153+
location when dragged. Hint: you will need to store the original
154154
``xy`` location of the rectangle which is stored as rect.xy and
155155
connect to the press, motion and release mouse events. When the mouse
156156
is pressed, check to see if the click occurs over your rectangle (see

doc/users/installing.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ your package manager will probably provide matplotlib prebuilt.
2222

2323
One single click installer and you are done.
2424

25-
Ok, so you want to do it the hard way?
25+
OK, so you want to do it the hard way?
2626
======================================
2727

2828
For some people, the prepackaged pythons discussed above are not an
@@ -109,7 +109,7 @@ installed, and so on. This file will be particularly useful to those
109109
packaging matplotlib.
110110

111111

112-
.. _install_requrements:
112+
.. _install_requirements:
113113

114114
Build requirements
115115
==================
@@ -152,7 +152,7 @@ backends and the capabilities they provide
152152
The Qt3 widgets library python wrappers for the QtAgg backend
153153

154154
:term:`pyqt` 4.0 or later
155-
The Qt4 widgets library python wrappersfor the Qt4Agg backend
155+
The Qt4 widgets library python wrappers for the Qt4Agg backend
156156

157157
:term:`pygtk` 2.2 or later
158158
The python wrappers for the GTK widgets library for use with the GTK or GTKAgg backend
@@ -201,5 +201,5 @@ repository, cd-ing into the release/osx dir, and following the
201201
instruction in the README. This directory has a Makefile which will
202202
automatically grab the zlib, png and freetype dependencies from the
203203
web, build them with the right flags to make universal libraries, and
204-
then build the matplotlib source and binary installers.
205-
204+
then build the matplotlib source and binary installers.
205+

doc/users/path_tutorial.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ for example CURVE 3 is a `bézier
7171
control point and one end point, and CURVE4 has three vertices for the
7272
two control points and the end point. The example below shows a
7373
CURVE4 Bézier spline -- the bézier curve will be contained in the
74-
convex hul of the start point, the two control points, and the end
74+
convex hull of the start point, the two control points, and the end
7575
point
7676

7777
.. plot::
@@ -123,7 +123,7 @@ Polygon, etc, are implemented with simple path. Plotting functions
123123
like :meth:`~matplotlib.axes.Axes.hist` and
124124
:meth:`~matplotlib.axes.Axes.bar`, which create a number of
125125
primitives, eg a bunch of Rectangles, can usually be implemented more
126-
efficiently using a compund path. The reason ``bar`` creates a list
126+
efficiently using a compound path. The reason ``bar`` creates a list
127127
of rectangles and not a compound path is largely historical: the
128128
:class:`~matplotlib.path.Path` code is comparatively new and ``bar``
129129
predates it. While we could change it now, it would break old code,

doc/users/shell.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Other python interpreters
6666
=========================
6767

6868
If you can't use ipython, and still want to use matplotlib/pylab from
69-
an interactive python shell, eg the plain-ol standard python
69+
an interactive python shell, eg the plain-ole standard python
7070
interactive interpreter, or the interpreter in your favorite IDE, you
7171
are going to need to understand what a matplotlib backend is
7272
:ref:`what-is-a-backend`.

doc/users/transforms_tutorial.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ functions to make them easy to plot (see
225225
:meth:`~matplotlib.axes.Axes.axvspan`) but for didactic purposes we
226226
will implement the horizontal span here using a blended
227227
transformation. This trick only works for separable transformations,
228-
like you see in normal cartesian coordinate systems, but not on
228+
like you see in normal Cartesian coordinate systems, but not on
229229
inseparable transformations like the
230230
:class:`~matplotlib.projections.polar.PolarAxes.PolarTransform`.
231231

@@ -301,7 +301,7 @@ operator in::
301301
shadow_transform = ax.transData + offset
302302

303303
showing that can chain transformations using the addition operator.
304-
This code says: first appy the data transformation ``ax.transData`` and
304+
This code says: first apply the data transformation ``ax.transData`` and
305305
then translate the data by `dx` and `dy` points.
306306

307307
.. plot::
@@ -352,7 +352,7 @@ and zoom. There is an efficiency here, because you can pan and zoom
352352
in your axes which affects the affine transformation, but you may not
353353
need to compute the potentially expensive nonlinear scales or
354354
projections on simple navigation events. It is also possible to
355-
multiply affine transformation matrices togeter, and then apply them
355+
multiply affine transformation matrices together, and then apply them
356356
to coordinates in one step. This is not true of all possible
357357
transformations.
358358

@@ -404,7 +404,7 @@ and we can use this same inverted transformation to go from the unit
404404

405405
The final piece is the ``self.transScale`` attribute, which is
406406
responsible for the optional non-linear scaling of the data, eg. for
407-
logarithmic axes. When an Axes is initally setup, this is just set to
407+
logarithmic axes. When an Axes is initially setup, this is just set to
408408
the identity transform, since the basic matplotlib axes has linear
409409
scale, but when you call a logarithmic scaling function like
410410
:meth:`~matplotlib.axes.Axes.semilogx` or explicitly set the scale to
@@ -426,7 +426,7 @@ the typical separable matplotlib Axes, with one additional piece
426426

427427
``transProjection`` handles the projection from the space,
428428
eg. latitude and longitude for map data, or radius and theta for polar
429-
data, to a separable cartesian coordinate system. There are several
429+
data, to a separable Cartesian coordinate system. There are several
430430
projection examples in the ``matplotlib.projections`` package, and the
431431
best way to learn more is to open the source for those packages and
432432
see how to make your own, since matplotlib supports extensible axes
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import time, sys
2+
import numpy as np
3+
import matplotlib.pyplot as plt
4+
5+
6+
def data_gen():
7+
t = data_gen.t
8+
data_gen.t += 0.05
9+
return np.sin(2*np.pi*t) * np.exp(-t/10.)
10+
data_gen.t = 0
11+
12+
fig = plt.figure()
13+
ax = fig.add_subplot(111)
14+
line, = ax.plot([], [], animated=True, lw=2)
15+
ax.set_ylim(-1.1, 1.1)
16+
ax.set_xlim(0, 5)
17+
ax.grid()
18+
xdata, ydata = [], []
19+
def run(*args):
20+
background = fig.canvas.copy_from_bbox(ax.bbox)
21+
# for profiling
22+
tstart = time.time()
23+
24+
while 1:
25+
# restore the clean slate background
26+
fig.canvas.restore_region(background)
27+
# update the data
28+
t = data_gen.t
29+
y = data_gen()
30+
xdata.append(t)
31+
ydata.append(y)
32+
xmin, xmax = ax.get_xlim()
33+
if t>=xmax:
34+
ax.set_xlim(xmin, 2*xmax)
35+
fig.canvas.draw()
36+
background = fig.canvas.copy_from_bbox(ax.bbox)
37+
38+
line.set_data(xdata, ydata)
39+
40+
# just draw the animated artist
41+
ax.draw_artist(line)
42+
# just redraw the axes rectangle
43+
fig.canvas.blit(ax.bbox)
44+
45+
if run.cnt==1000:
46+
# print the timing info and quit
47+
print 'FPS:' , 1000/(time.time()-tstart)
48+
sys.exit()
49+
50+
run.cnt += 1
51+
run.cnt = 0
52+
53+
54+
55+
manager = plt.get_current_fig_manager()
56+
manager.window.after(100, run)
57+
58+
plt.show()

lib/matplotlib/cbook.py

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

2727
try:
2828
preferredencoding = locale.getpreferredencoding()
29-
except ValueError:
29+
except (ValueError, ImportError):
3030
preferredencoding = None
3131

3232
def unicode_safe(s):

0 commit comments

Comments
 (0)