@@ -55,9 +55,9 @@ For physical coordinate systems (points or pixels) the origin is the
55
55
however, the origin is from the (right, top) of the figure or axes,
56
56
analogous to negative indexing of sequences.
57
57
58
- Optionally, you can specify arrow properties for adding an arrow
59
- from the text to the annotated point by giving a dictionary of arrow
60
- properties in the optional keyword argument ``arrowprops ``.
58
+ Optionally, you can enable drawing of an arrow from the text to the annotated
59
+ point by giving a dictionary of arrow properties in the optional keyword
60
+ argument ``arrowprops ``.
61
61
62
62
63
63
==================== =====================================================
@@ -90,9 +90,8 @@ annotations, including fancy arrows, see :ref:`plotting-guide-annotation`
90
90
and :ref: `pylab_examples-annotation_demo `.
91
91
92
92
93
- Do not proceed unless you already have read :ref: `annotations-tutorial `,
94
- :func: `~matplotlib.pyplot.text ` and
95
- :func: `~matplotlib.pyplot.annotate `!
93
+ Do not proceed unless you have already read :ref: `annotations-tutorial `,
94
+ :func: `~matplotlib.pyplot.text ` and :func: `~matplotlib.pyplot.annotate `!
96
95
97
96
98
97
.. _plotting-guide-annotation :
@@ -125,7 +124,7 @@ The patch object associated with the text can be accessed by::
125
124
126
125
The return value is an instance of FancyBboxPatch and the patch
127
126
properties like facecolor, edgewidth, etc. can be accessed and
128
- modified as usual. To change the shape of the box, use *set_boxstyle *
127
+ modified as usual. To change the shape of the box, use the *set_boxstyle *
129
128
method. ::
130
129
131
130
bb.set_boxstyle("rarrow", pad=0.6)
@@ -150,7 +149,7 @@ keyword arguments. Currently, following box styles are implemented.
150
149
.. plot :: mpl_examples/pylab_examples/fancybox_demo2.py
151
150
152
151
153
- Note that the attributes arguments can be specified within the style
152
+ Note that the attribute arguments can be specified within the style
154
153
name with separating comma (this form can be used as "boxstyle" value
155
154
of bbox argument when initializing the text instance) ::
156
155
@@ -177,7 +176,7 @@ annotated point is specified in the *data* coordinate and the annotating
177
176
text in *offset points *.
178
177
See :func: `~matplotlib.pyplot.annotate ` for available coordinate systems.
179
178
180
- An arrow connecting two point (xy & xytext) can be optionally drawn by
179
+ An arrow connecting two points (xy & xytext) can be optionally drawn by
181
180
specifying the ``arrowprops `` argument. To draw only an arrow, use
182
181
empty string as the first argument. ::
183
182
@@ -198,7 +197,7 @@ The arrow drawing takes a few steps.
198
197
2. If patch object is given (*patchA * & *patchB *), the path is clipped to
199
198
avoid the patch.
200
199
201
- 3. The path is further shrunk by given amount of pixels (*shirnkA *
200
+ 3. The path is further shrunk by given amount of pixels (*shrinkA *
202
201
& *shrinkB *)
203
202
204
203
4. The path is transmuted to arrow patch, which is controlled by the
@@ -209,7 +208,7 @@ The arrow drawing takes a few steps.
209
208
210
209
211
210
The creation of the connecting path between two points is controlled by
212
- ``connectionstyle `` key and following styles are available.
211
+ ``connectionstyle `` key and the following styles are available.
213
212
214
213
========== =============================================
215
214
Name Attrs
@@ -223,7 +222,7 @@ The creation of the connecting path between two points is controlled by
223
222
224
223
Note that "3" in ``angle3 `` and ``arc3 `` is meant to indicate that the
225
224
resulting path is a quadratic spline segment (three control
226
- points). As will be discussed below, some arrow style option only can
225
+ points). As will be discussed below, some arrow style options can only
227
226
be used when the connecting path is a quadratic spline.
228
227
229
228
The behavior of each connection style is (limitedly) demonstrated in the
@@ -255,9 +254,9 @@ an arrow patch, according to the given ``arrowstyle``.
255
254
256
255
.. plot :: mpl_examples/pylab_examples/fancyarrow_demo.py
257
256
258
- Some arrowstyles only work with connection style that generates a
257
+ Some arrowstyles only work with connection styles that generate a
259
258
quadratic-spline segment. They are ``fancy ``, ``simple ``, and ``wedge ``.
260
- For these arrow styles, you must use "angle3" or "arc3" connection
259
+ For these arrow styles, you must use the "angle3" or "arc3" connection
261
260
style.
262
261
263
262
If the annotation string is given, the patchA is set to the bbox patch
@@ -281,8 +280,8 @@ lower-left corner and (1,1) means top-right.
281
280
Placing Artist at the anchored location of the Axes
282
281
---------------------------------------------------
283
282
284
- There are class of artist that can be placed at the anchored location
285
- of the Axes. A common example is the legend. This type of artists can
283
+ There are classes of artists that can be placed at an anchored location
284
+ in the Axes. A common example is the legend. This type of artist can
286
285
be created by using the OffsetBox class. A few predefined classes are
287
286
available in ``mpl_toolkits.axes_grid.anchored_artists ``. ::
288
287
@@ -305,10 +304,10 @@ artists) is known in pixel size during the time of creation. For
305
304
example, If you want to draw a circle with fixed size of 20 pixel x 20
306
305
pixel (radius = 10 pixel), you can utilize
307
306
``AnchoredDrawingArea ``. The instance is created with a size of the
308
- drawing area (in pixel). And user can add arbitrary artist to the
307
+ drawing area (in pixels), and arbitrary artists can added to the
309
308
drawing area. Note that the extents of the artists that are added to
310
- the drawing area has nothing to do with the placement of the drawing
311
- area itself. The initial size only matters. ::
309
+ the drawing area are not related to the placement of the drawing
310
+ area itself. Only the initial size matters. ::
312
311
313
312
from mpl_toolkits.axes_grid.anchored_artists import AnchoredDrawingArea
314
313
@@ -319,27 +318,27 @@ area itself. The initial size only matters. ::
319
318
p2 = Circle((30, 10), 5, fc="r")
320
319
ada.drawing_area.add_artist(p2)
321
320
322
- The artists that are added to the drawing area should not have
323
- transform set (they will be overridden) and the dimension of those
321
+ The artists that are added to the drawing area should not have a
322
+ transform set (it will be overridden) and the dimensions of those
324
323
artists are interpreted as a pixel coordinate, i.e., the radius of the
325
- circles in above example are 10 pixel and 5 pixel , respectively.
324
+ circles in above example are 10 pixels and 5 pixels , respectively.
326
325
327
326
.. plot :: users/plotting/examples/anchored_box02.py
328
327
329
- Sometimes, you want to your artists scale with data coordinate (or
330
- other coordinate than canvas pixel ). You can use
328
+ Sometimes, you want your artists to scale with the data coordinate (or
329
+ coordinates other than canvas pixels ). You can use
331
330
``AnchoredAuxTransformBox `` class. This is similar to
332
331
``AnchoredDrawingArea `` except that the extent of the artist is
333
332
determined during the drawing time respecting the specified transform. ::
334
333
335
334
from mpl_toolkits.axes_grid.anchored_artists import AnchoredAuxTransformBox
336
335
337
336
box = AnchoredAuxTransformBox(ax.transData, loc=2)
338
- el = Ellipse((0,0), width=0.1, height=0.4, angle=30) # in data coordinates!
337
+ el = Ellipse((0,0), width=0.1, height=0.4, angle=30) # in data coordinates!
339
338
box.drawing_area.add_artist(el)
340
339
341
340
The ellipse in the above example will have width and height
342
- corresponds to 0.1 and 0.4 in data coordinate and will be
341
+ corresponding to 0.1 and 0.4 in data coordinateing and will be
343
342
automatically scaled when the view limits of the axes change.
344
343
345
344
.. plot :: users/plotting/examples/anchored_box03.py
@@ -353,10 +352,10 @@ legend (as a matter of fact, this is how the legend is created).
353
352
Note that unlike the legend, the ``bbox_transform `` is set
354
353
to IdentityTransform by default.
355
354
356
- Using Complex Coordinate with Annotation
357
- ----------------------------------------
355
+ Using Complex Coordinates with Annotations
356
+ ------------------------------------------
358
357
359
- The Annotation in matplotlib support several types of coordinate as
358
+ The Annotation in matplotlib supports several types of coordinates as
360
359
described in :ref: `annotations-tutorial `. For an advanced user who wants
361
360
more control, it supports a few other options.
362
361
@@ -392,16 +391,16 @@ more control, it supports a few other options.
392
391
393
392
Note that it is your responsibility that the extent of the
394
393
coordinate artist (*an1 * in above example) is determined before *an2 *
395
- gets drawn. In most cases, it means that an2 needs to be drawn
394
+ gets drawn. In most cases, it means that * an2 * needs to be drawn
396
395
later than *an1 *.
397
396
398
397
399
398
3. A callable object that returns an instance of either
400
399
:class: `~matplotlib.transforms.BboxBase ` or
401
400
:class: `~matplotlib.transforms.Transform `. If a transform is
402
- returned, it is same as 1 and if bbox is returned, it is same
403
- as 2. The callable object should take a single argument of
404
- renderer instance. For example, following two commands give
401
+ returned, it is the same as 1 and if a bbox is returned, it is the same
402
+ as 2. The callable object should take a single argument of the
403
+ renderer instance. For example, the following two commands give
405
404
identical results ::
406
405
407
406
an2 = ax.annotate("Test 2", xy=(1, 0.5), xycoords=an1,
@@ -410,22 +409,21 @@ more control, it supports a few other options.
410
409
xytext=(30,0), textcoords="offset points")
411
410
412
411
413
- 4. A tuple of two coordinate specification . The first item is for
414
- x-coordinate and the second is for y-coordinate. For example, ::
412
+ 4. A tuple of two coordinate specifications . The first item is for the
413
+ x-coordinate and the second is for the y-coordinate. For example, ::
415
414
416
415
annotate("Test", xy=(0.5, 1), xycoords=("data", "axes fraction"))
417
416
418
- 0.5 is in data coordinate , and 1 is in normalized axes coordinate .
417
+ 0.5 is in data coordinates , and 1 is in normalized axes coordinates .
419
418
You may use an artist or transform as with a tuple. For example,
420
419
421
420
.. plot :: users/plotting/examples/annotate_simple_coord02.py
422
421
:include-source:
423
422
424
423
425
- 5. Sometimes, you want your annotation with some "offset points", but
426
- not from the annotated point but from other
427
- point. :class: `~matplotlib.text.OffsetFrom ` is a helper class for such
428
- case.
424
+ 5. Sometimes, you want your annotation with some "offset points", not from the
425
+ annotated point but from some other point.
426
+ :class: `~matplotlib.text.OffsetFrom ` is a helper class for such cases.
429
427
430
428
.. plot :: users/plotting/examples/annotate_simple_coord03.py
431
429
:include-source:
@@ -435,28 +433,25 @@ more control, it supports a few other options.
435
433
Using ConnectorPatch
436
434
--------------------
437
435
438
- The ConnectorPatch is like an annotation without a text. While the
439
- annotate function is recommended in most of situation, the
440
- ConnectorPatch is useful when you want to connect points in different
441
- axes. ::
436
+ The ConnectorPatch is like an annotation without text. While the annotate
437
+ function is recommended in most situations, the ConnectorPatch is useful when
438
+ you want to connect points in different axes. ::
442
439
443
440
from matplotlib.patches import ConnectionPatch
444
441
xy = (0.2, 0.2)
445
442
con = ConnectionPatch(xyA=xy, xyB=xy, coordsA="data", coordsB="data",
446
443
axesA=ax1, axesB=ax2)
447
444
ax2.add_artist(con)
448
445
449
- The above code connects point xy in data coordinate of ``ax1 `` to
450
- point xy int data coordinate of ``ax2 ``. Here is a simple example.
446
+ The above code connects point xy in the data coordinates of ``ax1 `` to
447
+ point xy in the data coordinates of ``ax2 ``. Here is a simple example.
451
448
452
449
.. plot :: users/plotting/examples/connect_simple01.py
453
450
454
451
455
- While the ConnectorPatch instance can be added to any axes, but you
456
- may want it to be added to the axes in the latter (?) of the axes
457
- drawing order to prevent overlap (?) by other axes.
458
-
459
-
452
+ While the ConnectorPatch instance can be added to any axes, you may want to add
453
+ it to the axes that is latest in drawing order to prevent overlap by other
454
+ axes.
460
455
461
456
462
457
Advanced Topics
@@ -466,7 +461,7 @@ Zoom effect between Axes
466
461
------------------------
467
462
468
463
mpl_toolkits.axes_grid.inset_locator defines some patch classes useful
469
- for interconnect two axes. Understanding the code requires some
464
+ for interconnecting two axes. Understanding the code requires some
470
465
knowledge of how mpl's transform works. But, utilizing it will be
471
466
straight forward.
472
467
@@ -478,7 +473,7 @@ Define Custom BoxStyle
478
473
----------------------
479
474
480
475
You can use a custom box style. The value for the ``boxstyle `` can be a
481
- callable object in following forms.::
476
+ callable object in the following forms.::
482
477
483
478
def __call__(self, x0, y0, width, height, mutation_size,
484
479
aspect_ratio=1.):
@@ -491,7 +486,7 @@ callable object in following forms.::
491
486
- *aspect_ratio* : aspect-ratio for the mutation.
492
487
"""
493
488
path = ...
494
- return path
489
+ return path
495
490
496
491
Here is a complete example.
497
492
@@ -504,6 +499,6 @@ matplotlib.patches.BoxStyle._Base as demonstrated below.
504
499
:include-source:
505
500
506
501
507
- Similarly, you can define custom ConnectionStyle and custom ArrowStyle.
502
+ Similarly, you can define a custom ConnectionStyle and a custom ArrowStyle.
508
503
See the source code of ``lib/matplotlib/patches.py `` and check
509
504
how each style class is defined.
0 commit comments