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

Skip to content

Commit 7c5b981

Browse files
committed
[ 2029956 ] Fix documentation warnings.
svn path=/trunk/matplotlib/; revision=6035
1 parent db6cf1c commit 7c5b981

2 files changed

Lines changed: 154 additions & 118 deletions

File tree

lib/matplotlib/backend_bases.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1464,7 +1464,7 @@ def stop_event_loop_default(self):
14641464
14651465
Call signature::
14661466
1467-
stop_event_loop_default(self)
1467+
stop_event_loop_default(self)
14681468
"""
14691469
self._looping = False
14701470

lib/matplotlib/quiver.py

Lines changed: 153 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@
4040
Arguments:
4141
4242
*X*, *Y*:
43-
The x and y coordinates of the arrow locations
44-
(default is tail of arrow; see *pivot* kwarg)
43+
44+
The x and y coordinates of the arrow locations (default is tail of
45+
arrow; see *pivot* kwarg)
4546
4647
*U*, *V*:
48+
4749
give the *x* and *y* components of the arrow vectors
4850
4951
*C*:
@@ -61,28 +63,31 @@
6163
Keyword arguments:
6264
6365
*units*: ['width' | 'height' | 'dots' | 'inches' | 'x' | 'y' ]
64-
arrow units; the arrow dimensions *except for length* are
65-
in multiples of this unit.
66+
arrow units; the arrow dimensions *except for length* are in
67+
multiples of this unit.
6668
6769
* 'width' or 'height': the width or height of the axes
68-
* 'dots' or 'inches': pixels or inches, based on the figure dpi
70+
71+
* 'dots' or 'inches': pixels or inches, based on the figure dpi
72+
6973
* 'x' or 'y': *X* or *Y* data units
7074
7175
In all cases the arrow aspect ratio is 1, so that if *U*==*V* the
72-
angle of the arrow on the plot is 45 degrees CCW from the *x*-axis.
76+
angle of the arrow on the plot is 45 degrees CCW from the
77+
*x*-axis.
7378
74-
The arrows scale differently depending on the units, however.
75-
For 'x' or 'y', the arrows get larger as one zooms in; for other
79+
The arrows scale differently depending on the units, however. For
80+
'x' or 'y', the arrows get larger as one zooms in; for other
7681
units, the arrow size is independent of the zoom state. For
7782
'width or 'height', the arrow size increases with the width and
7883
height of the axes, respectively, when the the window is resized;
7984
for 'dots' or 'inches', resizing does not change the arrows.
8085
8186
*scale*: [ None | float ]
82-
data units per arrow unit, e.g. m/s per plot width;
83-
a smaller scale parameter makes the arrow longer.
84-
If *None*, a simple autoscaling algorithm is used, based
85-
on the average vector length and the number of vectors.
87+
data units per arrow unit, e.g. m/s per plot width; a smaller
88+
scale parameter makes the arrow longer. If *None*, a simple
89+
autoscaling algorithm is used, based on the average vector length
90+
and the number of vectors.
8691
8792
*width*:
8893
shaft width in arrow units; default depends on choice of units,
@@ -109,8 +114,8 @@
109114
Default is 1.
110115
111116
*pivot*: [ 'tail' | 'middle' | 'tip' ]
112-
The part of the arrow that is at the grid point; the arrow
113-
rotates about this point, hence the name *pivot*.
117+
The part of the arrow that is at the grid point; the arrow rotates
118+
about this point, hence the name *pivot*.
114119
115120
*color*: [ color | color sequence ]
116121
This is a synonym for the
@@ -155,23 +160,23 @@
155160
Keyword arguments:
156161
157162
*coordinates* = [ 'axes' | 'figure' | 'data' | 'inches' ]
158-
Coordinate system and units for *X*, *Y*: 'axes' and 'figure'
159-
are normalized coordinate systems with 0,0 in the lower
160-
left and 1,1 in the upper right; 'data' are the axes
161-
data coordinates (used for the locations of the vectors
162-
in the quiver plot itself); 'inches' is position in the
163-
figure in inches, with 0,0 at the lower left corner.
163+
Coordinate system and units for *X*, *Y*: 'axes' and 'figure' are
164+
normalized coordinate systems with 0,0 in the lower left and 1,1
165+
in the upper right; 'data' are the axes data coordinates (used for
166+
the locations of the vectors in the quiver plot itself); 'inches'
167+
is position in the figure in inches, with 0,0 at the lower left
168+
corner.
164169
165170
*color*:
166171
overrides face and edge colors from *Q*.
167172
168173
*labelpos* = [ 'N' | 'S' | 'E' | 'W' ]
169-
Position the label above, below, to the right, to the left
170-
of the arrow, respectively.
174+
Position the label above, below, to the right, to the left of the
175+
arrow, respectively.
171176
172177
*labelsep*:
173-
Distance in inches between the arrow and the label.
174-
Default is 0.1
178+
Distance in inches between the arrow and the label. Default is
179+
0.1
175180
176181
*labelcolor*:
177182
defaults to default :class:`~matplotlib.text.Text` color.
@@ -557,88 +562,100 @@ def _h_arrows(self, length):
557562
Default is 9
558563
559564
*pivot*: [ 'tip' | 'middle' ]
560-
The part of the arrow that is at the grid point; the arrow
561-
rotates about this point, hence the name *pivot*.
562-
Default is 'tip'
565+
The part of the arrow that is at the grid point; the arrow rotates
566+
about this point, hence the name *pivot*. Default is 'tip'
563567
564568
*barbcolor*: [ color | color sequence ]
565-
Specifies the color all parts of the barb except any flags.
566-
This parameter is analagous to the *edgecolor* parameter
567-
for polygons, which can be used instead. However this parameter
568-
will override facecolor.
569+
Specifies the color all parts of the barb except any flags. This
570+
parameter is analagous to the *edgecolor* parameter for polygons,
571+
which can be used instead. However this parameter will override
572+
facecolor.
569573
570574
*flagcolor*: [ color | color sequence ]
571-
Specifies the color of any flags on the barb.
572-
This parameter is analagous to the *facecolor* parameter
573-
for polygons, which can be used instead. However this parameter
574-
will override facecolor. If this is not set (and *C* has not either)
575-
then *flagcolor* will be set to match *barbcolor* so that the barb
576-
has a uniform color. If *C* has been set, *flagcolor* has no effect.
575+
Specifies the color of any flags on the barb. This parameter is
576+
analagous to the *facecolor* parameter for polygons, which can be
577+
used instead. However this parameter will override facecolor. If
578+
this is not set (and *C* has not either) then *flagcolor* will be
579+
set to match *barbcolor* so that the barb has a uniform color. If
580+
*C* has been set, *flagcolor* has no effect.
577581
578582
*sizes*:
579-
A dictionary of coefficients specifying the ratio of a given feature
580-
to the length of the barb. Only those values one wishes to override
581-
need to be included. These features include:
582-
'spacing' - space between features (flags, full/half barbs)
583-
'height' - height (distance from shaft to top) of a flag or full barb
584-
'width' - width of a flag, twice the width of a full barb
585-
'emptybarb' - radius of the circle used for low magnitudes
583+
A dictionary of coefficients specifying the ratio of a given
584+
feature to the length of the barb. Only those values one wishes to
585+
override need to be included. These features include:
586+
587+
- 'spacing' - space between features (flags, full/half barbs)
588+
589+
- 'height' - height (distance from shaft to top) of a flag or
590+
full barb
591+
592+
- 'width' - width of a flag, twice the width of a full barb
593+
594+
- 'emptybarb' - radius of the circle used for low magnitudes
586595
587596
*fill_empty*:
588-
A flag on whether the empty barbs (circles) that are drawn should be filled
589-
with the flag color. If they are not filled, they will be drawn such that
590-
no color is applied to the center.
591-
Default is False
597+
A flag on whether the empty barbs (circles) that are drawn should
598+
be filled with the flag color. If they are not filled, they will
599+
be drawn such that no color is applied to the center. Default is
600+
False
592601
593602
*rounding*:
594-
A flag to indicate whether the vector magnitude should be rounded when
595-
allocating barb components. If True, the magnitude is rounded to the
596-
nearest multiple of the half-barb increment. If False, the magnitude
597-
is simply truncated to the next lowest multiple.
598-
Default is True
603+
A flag to indicate whether the vector magnitude should be rounded
604+
when allocating barb components. If True, the magnitude is
605+
rounded to the nearest multiple of the half-barb increment. If
606+
False, the magnitude is simply truncated to the next lowest
607+
multiple. Default is True
599608
600609
*barb_increments*:
601-
A dictionary of increments specifying values to associate with different
602-
parts of the barb. Only those values one wishes to override need to be
603-
included.
604-
'half' - half barbs (Default is 5)
605-
'full' - full barbs (Default is 10)
606-
'flag' - flags (default is 50)
610+
A dictionary of increments specifying values to associate with
611+
different parts of the barb. Only those values one wishes to
612+
override need to be included.
613+
614+
- 'half' - half barbs (Default is 5)
615+
616+
- 'full' - full barbs (Default is 10)
617+
618+
- 'flag' - flags (default is 50)
607619
608620
*flip_barb*:
609-
Either a single boolean flag or an array of booleans. Single boolean
610-
indicates whether the lines and flags should point opposite to normal
611-
for all barbs. An array (which should be the same size as the other
612-
data arrays) indicates whether to flip for each individual barb.
613-
Normal behavior is for the barbs and lines to point right (comes from
614-
wind barbs having these features point towards low pressure in the
615-
Northern Hemisphere.)
616-
Default is False
621+
Either a single boolean flag or an array of booleans. Single
622+
boolean indicates whether the lines and flags should point
623+
opposite to normal for all barbs. An array (which should be the
624+
same size as the other data arrays) indicates whether to flip for
625+
each individual barb. Normal behavior is for the barbs and lines
626+
to point right (comes from wind barbs having these features point
627+
towards low pressure in the Northern Hemisphere.) Default is
628+
False
617629
618630
Barbs are traditionally used in meteorology as a way to plot the speed
619-
and direction of wind observations, but can technically be used to plot
620-
any two dimensional vector quantity. As opposed to arrows, which give
621-
vector magnitude by the length of the arrow, the barbs give more quantitative
622-
information about the vector magnitude by putting slanted lines or a triangle
623-
for various increments in magnitude, as show schematically below:
624-
625-
/\ \
626-
/ \ \
627-
/ \ \ \
628-
/ \ \ \
629-
------------------------------
630-
631-
The largest increment is given by a triangle (or "flag"). After those come full
632-
lines (barbs). The smallest increment is a half line. There is only, of
633-
course, ever at most 1 half line. If the magnitude is small and only needs a
634-
single half-line and no full lines or triangles, the half-line is offset from
635-
the end of the barb so that it can be easily distinguished from barbs with a
636-
single full line. The magnitude for the barb shown above would nominally be
637-
65, using the standard increments of 50, 10, and 5.
631+
and direction of wind observations, but can technically be used to
632+
plot any two dimensional vector quantity. As opposed to arrows, which
633+
give vector magnitude by the length of the arrow, the barbs give more
634+
quantitative information about the vector magnitude by putting slanted
635+
lines or a triangle for various increments in magnitude, as show
636+
schematically below::
637+
638+
: /\ \\
639+
: / \ \\
640+
: / \ \ \\
641+
: / \ \ \\
642+
: ------------------------------
643+
644+
.. note the double \\ at the end of each line to make the figure
645+
.. render correctly
646+
647+
The largest increment is given by a triangle (or "flag"). After those
648+
come full lines (barbs). The smallest increment is a half line. There
649+
is only, of course, ever at most 1 half line. If the magnitude is
650+
small and only needs a single half-line and no full lines or
651+
triangles, the half-line is offset from the end of the barb so that it
652+
can be easily distinguished from barbs with a single full line. The
653+
magnitude for the barb shown above would nominally be 65, using the
654+
standard increments of 50, 10, and 5.
638655
639656
linewidths and edgecolors can be used to customize the barb.
640-
Additional :class:`~matplotlib.collections.PolyCollection`
641-
keyword arguments:
657+
Additional :class:`~matplotlib.collections.PolyCollection` keyword
658+
arguments:
642659
643660
%(PolyCollection)s
644661
""" % martist.kwdocd
@@ -647,15 +664,15 @@ class Barbs(collections.PolyCollection):
647664
'''
648665
Specialized PolyCollection for barbs.
649666
650-
The only API method is set_UVC(), which can be used
651-
to change the size, orientation, and color of the
652-
arrows. Locations are changed using the set_offsets() collection
653-
method.Possibly this method will be useful in animations.
667+
The only API method is :meth:`set_UVC`, which can be used to
668+
change the size, orientation, and color of the arrows. Locations
669+
are changed using the :meth:`set_offsets` collection method.
670+
Possibly this method will be useful in animations.
654671
655-
There is one internal function _find_tails() which finds exactly
656-
what should be put on the barb given the vector magnitude. From there
657-
_make_barbs() is used to find the vertices of the polygon to represent the
658-
barb based on this information.
672+
There is one internal function :meth:`_find_tails` which finds
673+
exactly what should be put on the barb given the vector magnitude.
674+
From there :meth:`_make_barbs` is used to find the vertices of the
675+
polygon to represent the barb based on this information.
659676
'''
660677
#This may be an abuse of polygons here to render what is essentially maybe
661678
#1 triangle and a series of lines. It works fine as far as I can tell
@@ -714,11 +731,14 @@ def _find_tails(self, mag, rounding=True, half=5, full=10, flag=50):
714731
half a barb. Mag should be the magnitude of a vector (ie. >= 0).
715732
716733
This returns a tuple of:
717-
(number of flags, number of barbs, half_flag, empty_flag)
718-
half_flag is a boolean whether half of a barb is needed, since there
719-
should only ever be one half on a given barb. Empty flag is an array
720-
of flags to easily tell if a barb is empty (too low to plot any
721-
barbs/flags.'''
734+
735+
(*number of flags*, *number of barbs*, *half_flag*, *empty_flag*)
736+
737+
*half_flag* is a boolean whether half of a barb is needed,
738+
since there should only ever be one half on a given
739+
barb. *empty_flag* flag is an array of flags to easily tell if
740+
a barb is empty (too low to plot any barbs/flags.
741+
'''
722742

723743
#If rounding, round to the nearest multiple of half, the smallest
724744
#increment
@@ -738,25 +758,41 @@ def _find_tails(self, mag, rounding=True, half=5, full=10, flag=50):
738758

739759
def _make_barbs(self, u, v, nflags, nbarbs, half_barb, empty_flag, length,
740760
pivot, sizes, fill_empty, flip):
741-
'''This function actually creates the wind barbs. u and v are
742-
components of the vector in the x and y directions, respectively.
743-
nflags, nbarbs, and half_barb, empty_flag are, respectively, the number
744-
of flags, number of barbs, flag for half a barb, and flag for empty
745-
barb, ostensibly obtained from _find_tails. length is the length of
746-
the barb staff in points. pivot specifies the point on the barb around
747-
which the entire barb should be rotated. Right now valid options are
748-
'head' and 'middle'. sizes is a dictionary of coefficients specifying
749-
the ratio of a given feature to the length of the barb. These features
761+
'''This function actually creates the wind barbs. *u* and *v*
762+
are components of the vector in the *x* and *y* directions,
763+
respectively.
764+
765+
*nflags*, *nbarbs*, and *half_barb*, empty_flag* are,
766+
*respectively, the number of flags, number of barbs, flag for
767+
*half a barb, and flag for empty barb, ostensibly obtained
768+
*from :meth:`_find_tails`.
769+
770+
*length* is the length of the barb staff in points.
771+
772+
*pivot* specifies the point on the barb around which the
773+
entire barb should be rotated. Right now, valid options are
774+
'head' and 'middle'.
775+
776+
*sizes* is a dictionary of coefficients specifying the ratio
777+
of a given feature to the length of the barb. These features
750778
include:
751779
752-
spacing - space between features (flags, full/half barbs)
753-
height - height (distance from shaft of top) of a flag or full barb
754-
width - width of a flag, twice the width of a full barb
755-
emptybarb - radius of the circle used for low magnitudes
780+
- *spacing*: space between features (flags, full/half
781+
barbs)
782+
783+
- *height*: distance from shaft of top of a flag or full
784+
barb
785+
786+
- *width* - width of a flag, twice the width of a full barb
787+
788+
- *emptybarb* - radius of the circle used for low
789+
magnitudes
790+
791+
*fill_empty* specifies whether the circle representing an
792+
empty barb should be filled or not (this changes the drawing
793+
of the polygon).
756794
757-
fill_empty specifies whether the circle representing an empty barb
758-
should be filled or not (this changes the drawing of the polygon).
759-
flip is a flag indicating whether the features should be flipped to
795+
*flip* is a flag indicating whether the features should be flipped to
760796
the other side of the barb (useful for winds in the southern
761797
hemisphere.
762798

0 commit comments

Comments
 (0)