Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fe5f3a5

Browse filesBrowse files
authored
Merge pull request #16789 from anntzer/colldocmark
Update markup for collections docstrings.
2 parents 61f5fa5 + 07d0b6a commit fe5f3a5
Copy full SHA for fe5f3a5

File tree

Expand file treeCollapse file tree

1 file changed

+70
-79
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+70
-79
lines changed

‎lib/matplotlib/collections.py

Copy file name to clipboardExpand all lines: lib/matplotlib/collections.py
+70-79Lines changed: 70 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,19 @@ class Collection(artist.Artist, cm.ScalarMappable):
4141
4242
Keyword arguments and default values:
4343
44-
* *edgecolors*: None
45-
* *facecolors*: None
46-
* *linewidths*: None
47-
* *capstyle*: None
48-
* *joinstyle*: None
49-
* *antialiaseds*: None
50-
* *offsets*: None
51-
* *transOffset*: transforms.IdentityTransform()
52-
* *offset_position*: 'screen' (default) or 'data'
53-
* *norm*: None (optional for
54-
:class:`matplotlib.cm.ScalarMappable`)
55-
* *cmap*: None (optional for
56-
:class:`matplotlib.cm.ScalarMappable`)
57-
* *hatch*: None
58-
* *zorder*: 1
44+
- *edgecolors*: None
45+
- *facecolors*: None
46+
- *linewidths*: None
47+
- *capstyle*: None
48+
- *joinstyle*: None
49+
- *antialiaseds*: None
50+
- *offsets*: None
51+
- *transOffset*: transforms.IdentityTransform()
52+
- *offset_position*: 'screen' (default) or 'data'
53+
- *norm*: None (optional for `matplotlib.cm.ScalarMappable`)
54+
- *cmap*: None (optional for `matplotlib.cm.ScalarMappable`)
55+
- *hatch*: None
56+
- *zorder*: 1
5957
6058
*offsets* and *transOffset* are used to translate the patch after
6159
rendering (default no offsets). If offset_position is 'screen'
@@ -64,22 +62,22 @@ class Collection(artist.Artist, cm.ScalarMappable):
6462
offset_position is 'data', the offset is applied before the master
6563
transform, i.e., the offsets are in data coordinates.
6664
67-
If any of *edgecolors*, *facecolors*, *linewidths*, *antialiaseds*
68-
are None, they default to their :data:`matplotlib.rcParams` patch
69-
setting, in sequence form.
65+
If any of *edgecolors*, *facecolors*, *linewidths*, *antialiaseds* are
66+
None, they default to their `.rcParams` patch setting, in sequence form.
7067
71-
The use of :class:`~matplotlib.cm.ScalarMappable` is optional. If
72-
the :class:`~matplotlib.cm.ScalarMappable` matrix _A is not None
73-
(i.e., a call to set_array has been made), at draw time a call to
74-
scalar mappable will be made to set the face colors.
68+
The use of `~matplotlib.cm.ScalarMappable` functionality is optional. If
69+
the `~matplotlib.cm.ScalarMappable` matrix ``_A`` has been set (via a call
70+
to `~.ScalarMappable.set_array`), at draw time a call to scalar mappable
71+
will be made to set the face colors.
7572
"""
73+
7674
_offsets = np.zeros((0, 2))
7775
_transOffset = transforms.IdentityTransform()
7876
#: Either a list of 3x3 arrays or an Nx3x3 array of transforms, suitable
7977
#: for the `all_transforms` argument to
80-
#: :meth:`~matplotlib.backend_bases.RendererBase.draw_path_collection`;
78+
#: `~matplotlib.backend_bases.RendererBase.draw_path_collection`;
8179
#: each 3x3 array is used to initialize an
82-
#: :class:`~matplotlib.transforms.Affine2D` object.
80+
#: `~matplotlib.transforms.Affine2D` object.
8381
#: Each kind of collection defines this based on its arguments.
8482
_transforms = np.empty((0, 3, 3))
8583

@@ -827,23 +825,20 @@ def update_from(self, other):
827825
docstring.interpd.update(Collection="""\
828826
Valid Collection keyword arguments:
829827
830-
* *edgecolors*: None
831-
* *facecolors*: None
832-
* *linewidths*: None
833-
* *antialiaseds*: None
834-
* *offsets*: None
835-
* *transOffset*: transforms.IdentityTransform()
836-
* *norm*: None (optional for
837-
:class:`matplotlib.cm.ScalarMappable`)
838-
* *cmap*: None (optional for
839-
:class:`matplotlib.cm.ScalarMappable`)
828+
- *edgecolors*: None
829+
- *facecolors*: None
830+
- *linewidths*: None
831+
- *antialiaseds*: None
832+
- *offsets*: None
833+
- *transOffset*: transforms.IdentityTransform()
834+
- *norm*: None (optional for `matplotlib.cm.ScalarMappable`)
835+
- *cmap*: None (optional for `matplotlib.cm.ScalarMappable`)
840836
841837
*offsets* and *transOffset* are used to translate the patch after
842838
rendering (default no offsets)
843839
844-
If any of *edgecolors*, *facecolors*, *linewidths*, *antialiaseds*
845-
are None, they default to their :data:`matplotlib.rcParams` patch
846-
setting, in sequence form.
840+
If any of *edgecolors*, *facecolors*, *linewidths*, *antialiaseds* are
841+
None, they default to their `.rcParams` patch setting, in sequence form.
847842
""")
848843

849844

@@ -897,14 +892,13 @@ def draw(self, renderer):
897892

898893
class PathCollection(_CollectionWithSizes):
899894
"""
900-
This is the most basic :class:`Collection` subclass.
901-
A :class:`PathCollection` is e.g. created by a :meth:`~.Axes.scatter` plot.
895+
The most basic `Collection` subclass, created e.g. by `~.Axes.scatter`.
902896
"""
897+
903898
@docstring.dedent_interpd
904899
def __init__(self, paths, sizes=None, **kwargs):
905900
"""
906-
*paths* is a sequence of :class:`matplotlib.path.Path`
907-
instances.
901+
*paths* is a sequence of `matplotlib.path.Path` instances.
908902
909903
%(Collection)s
910904
"""
@@ -925,7 +919,7 @@ def legend_elements(self, prop="colors", num="auto",
925919
fmt=None, func=lambda x: x, **kwargs):
926920
"""
927921
Creates legend handles and labels for a PathCollection. This is useful
928-
for obtaining a legend for a :meth:`~.Axes.scatter` plot. E.g.::
922+
for obtaining a legend for a `~.Axes.scatter` plot. E.g.::
929923
930924
scatter = plt.scatter([1, 2, 3], [4, 5, 6], c=[7, 2, 3])
931925
plt.legend(*scatter.legend_elements())
@@ -953,13 +947,13 @@ def legend_elements(self, prop="colors", num="auto",
953947
a valid input for a `~.StrMethodFormatter`. If None (the default),
954948
use a `~.ScalarFormatter`.
955949
func : function, default *lambda x: x*
956-
Function to calculate the labels. Often the size (or color)
957-
argument to :meth:`~.Axes.scatter` will have been pre-processed
958-
by the user using a function *s = f(x)* to make the markers
959-
visible; e.g. *size = np.log10(x)*. Providing the inverse of this
950+
Function to calculate the labels. Often the size (or color)
951+
argument to `~.Axes.scatter` will have been pre-processed by the
952+
user using a function ``s = f(x)`` to make the markers visible;
953+
e.g. ``size = np.log10(x)``. Providing the inverse of this
960954
function here allows that pre-processing to be inverted, so that
961-
the legend labels have the correct values;
962-
e.g. *func = np.exp(x, 10)*.
955+
the legend labels have the correct values; e.g. ``func = lambda
956+
x: 10**x``.
963957
kwargs : further parameters
964958
Allowed keyword arguments are *color* and *size*. E.g. it may be
965959
useful to set the color of the markers if *prop="sizes"* is used;
@@ -1334,8 +1328,9 @@ def __init__(self, segments, # Can be None.
13341328
13351329
Notes
13361330
-----
1337-
If *linewidths*, *colors*, or *antialiaseds* is None, they
1338-
default to their rcParams setting, in sequence form.
1331+
If any of *edgecolors*, *facecolors*, *linewidths*, *antialiaseds* are
1332+
None, they default to their `.rcParams` patch setting, in sequence
1333+
form.
13391334
13401335
If *offsets* and *transOffset* are not None, then
13411336
*offsets* are transformed by *transOffset* and applied after
@@ -1350,11 +1345,10 @@ def __init__(self, segments, # Can be None.
13501345
and this value will be added cumulatively to each successive
13511346
segment, so as to produce a set of successively offset curves.
13521347
1353-
The use of :class:`~matplotlib.cm.ScalarMappable` is optional.
1354-
If the :class:`~matplotlib.cm.ScalarMappable` array
1355-
:attr:`~matplotlib.cm.ScalarMappable._A` is not None (i.e., a call to
1356-
:meth:`~matplotlib.cm.ScalarMappable.set_array` has been made), at
1357-
draw time a call to scalar mappable will be made to set the colors.
1348+
The use of `~matplotlib.cm.ScalarMappable` functionality is optional.
1349+
If the `~matplotlib.cm.ScalarMappable` matrix ``_A`` has been set (via
1350+
a call to `~.ScalarMappable.set_array`), at draw time a call to scalar
1351+
mappable will be made to set the face colors.
13581352
"""
13591353
if colors is None:
13601354
colors = mpl.rcParams['lines.color']
@@ -1725,12 +1719,11 @@ def __init__(self, widths, heights, angles, units='points', **kwargs):
17251719
units : {'points', 'inches', 'dots', 'width', 'height', 'x', 'y', 'xy'}
17261720
17271721
The units in which majors and minors are given; 'width' and
1728-
'height' refer to the dimensions of the axes, while 'x'
1729-
and 'y' refer to the *offsets* data units. 'xy' differs
1730-
from all others in that the angle as plotted varies with
1731-
the aspect ratio, and equals the specified angle only when
1732-
the aspect ratio is unity. Hence it behaves the same as
1733-
the :class:`~matplotlib.patches.Ellipse` with
1722+
'height' refer to the dimensions of the axes, while 'x' and 'y'
1723+
refer to the *offsets* data units. 'xy' differs from all others in
1724+
that the angle as plotted varies with the aspect ratio, and equals
1725+
the specified angle only when the aspect ratio is unity. Hence
1726+
it behaves the same as the `~matplotlib.patches.Ellipse` with
17341727
``axes.transData`` as its transform.
17351728
17361729
Other Parameters
@@ -1820,14 +1813,14 @@ def __init__(self, patches, match_original=False, **kwargs):
18201813
providing the standard collection arguments, facecolor,
18211814
edgecolor, linewidths, norm or cmap.
18221815
1823-
If any of *edgecolors*, *facecolors*, *linewidths*,
1824-
*antialiaseds* are None, they default to their
1825-
:data:`matplotlib.rcParams` patch setting, in sequence form.
1816+
If any of *edgecolors*, *facecolors*, *linewidths*, *antialiaseds* are
1817+
None, they default to their `.rcParams` patch setting, in sequence
1818+
form.
18261819
1827-
The use of :class:`~matplotlib.cm.ScalarMappable` is optional.
1828-
If the :class:`~matplotlib.cm.ScalarMappable` matrix _A is not
1829-
None (i.e., a call to set_array has been made), at draw time a
1830-
call to scalar mappable will be made to set the face colors.
1820+
The use of `~matplotlib.cm.ScalarMappable` functionality is optional.
1821+
If the `~matplotlib.cm.ScalarMappable` matrix ``_A`` has been set (via
1822+
a call to `~.ScalarMappable.set_array`), at draw time a call to scalar
1823+
mappable will be made to set the face colors.
18311824
"""
18321825

18331826
if match_original:
@@ -1920,11 +1913,11 @@ class QuadMesh(Collection):
19201913
"""
19211914
Class for the efficient drawing of a quadrilateral mesh.
19221915
1923-
A quadrilateral mesh consists of a grid of vertices. The
1924-
dimensions of this array are (*meshWidth* + 1, *meshHeight* +
1925-
1). Each vertex in the mesh has a different set of "mesh
1926-
coordinates" representing its position in the topology of the
1927-
mesh. For any values (*m*, *n*) such that 0 <= *m* <= *meshWidth*
1916+
A quadrilateral mesh consists of a grid of vertices.
1917+
The dimensions of this array are (*meshWidth* + 1, *meshHeight* + 1).
1918+
Each vertex in the mesh has a different set of "mesh coordinates"
1919+
representing its position in the topology of the mesh.
1920+
For any values (*m*, *n*) such that 0 <= *m* <= *meshWidth*
19281921
and 0 <= *n* <= *meshHeight*, the vertices at mesh coordinates
19291922
(*m*, *n*), (*m*, *n* + 1), (*m* + 1, *n* + 1), and (*m* + 1, *n*)
19301923
form one of the quadrilaterals in the mesh. There are thus
@@ -1937,13 +1930,11 @@ class QuadMesh(Collection):
19371930
function that maps from a data point to its corresponding color,
19381931
use the :meth:`set_cmap` method. Each of these arrays is indexed in
19391932
row-major order by the mesh coordinates of the vertex (or the mesh
1940-
coordinates of the lower left vertex, in the case of the
1941-
colors).
1933+
coordinates of the lower left vertex, in the case of the colors).
19421934
1943-
For example, the first entry in *coordinates* is the
1944-
coordinates of the vertex at mesh coordinates (0, 0), then the one
1945-
at (0, 1), then at (0, 2) .. (0, meshWidth), (1, 0), (1, 1), and
1946-
so on.
1935+
For example, the first entry in *coordinates* is the coordinates of the
1936+
vertex at mesh coordinates (0, 0), then the one at (0, 1), then at (0, 2)
1937+
.. (0, meshWidth), (1, 0), (1, 1), and so on.
19471938
19481939
*shading* may be 'flat', or 'gouraud'
19491940
"""

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.