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 30b5800

Browse filesBrowse files
authored
Merge pull request #9595 from dstansby/stackplot-docstring
Convert stackplot docstring to numpydoc
2 parents 982c990 + a09ca67 commit 30b5800
Copy full SHA for 30b5800

File tree

Expand file treeCollapse file tree

1 file changed

+34
-23
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+34
-23
lines changed

‎lib/matplotlib/stackplot.py

Copy file name to clipboardExpand all lines: lib/matplotlib/stackplot.py
+34-23Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,40 +19,51 @@
1919

2020

2121
def stackplot(axes, x, *args, **kwargs):
22-
"""Draws a stacked area plot.
22+
"""
23+
Draws a stacked area plot.
2324
24-
*x* : 1d array of dimension N
25+
Parameters
26+
----------
27+
x : 1d array of dimension N
2528
26-
*y* : 2d array of dimension MxN, OR any number 1d arrays each of dimension
27-
1xN. The data is assumed to be unstacked. Each of the following
28-
calls is legal::
29+
y : 2d array of dimension MxN, OR sequence of 1d arrays each of dimension 1xN
30+
The data is assumed to be unstacked. Each of the following
31+
calls is legal::
2932
3033
stackplot(x, y) # where y is MxN
3134
stackplot(x, y1, y2, y3, y4) # where y1, y2, y3, y4, are all 1xNm
3235
33-
Keyword arguments:
36+
baseline : string
37+
One of ``['zero', 'sym', 'wiggle', 'weighted_wiggle']``.
38+
39+
Method used to calculate the baseline. ``'zero'`` is just a
40+
simple stacked plot.
41+
``'sym'`` is symmetric around zero and is sometimes called
42+
'ThemeRiver'.
43+
``'wiggle'`` minimizes the sum of the squared slopes.
44+
``'weighted_wiggle'`` does the same but weights to account for size of
45+
each layer. It is also called 'Streamgraph'-layout. More details
46+
can be found at http://leebyron.com/streamgraph/.
47+
3448
35-
*baseline* : ['zero', 'sym', 'wiggle', 'weighted_wiggle']
36-
Method used to calculate the baseline. 'zero' is just a
37-
simple stacked plot. 'sym' is symmetric around zero and
38-
is sometimes called `ThemeRiver`. 'wiggle' minimizes the
39-
sum of the squared slopes. 'weighted_wiggle' does the
40-
same but weights to account for size of each layer.
41-
It is also called `Streamgraph`-layout. More details
42-
can be found at http://leebyron.com/streamgraph/.
49+
labels : Length N sequence of strings
50+
Labels to assign to each data series.
4351
4452
45-
*labels* : A list or tuple of labels to assign to each data series.
53+
colors : Length N sequence of colors
54+
A list or tuple of colors. These will be cycled through and used to
55+
colour the stacked areas.
4656
57+
**kwargs :
58+
All other keyword arguments are passed to
59+
`Axes.fill_between`
4760
48-
*colors* : A list or tuple of colors. These will be cycled through and
49-
used to colour the stacked areas.
50-
All other keyword arguments are passed to
51-
:func:`~matplotlib.Axes.fill_between`
5261
53-
Returns *r* : A list of
54-
:class:`~matplotlib.collections.PolyCollection`, one for each
55-
element in the stacked area plot.
62+
Returns
63+
-------
64+
r : list
65+
A list of `PolyCollection`, one for each element in the stacked area
66+
plot.
5667
"""
5768

5869
y = np.row_stack(args)
@@ -116,6 +127,6 @@ def stackplot(axes, x, *args, **kwargs):
116127
color = axes._get_lines.get_next_color()
117128
r.append(axes.fill_between(x, stack[i, :], stack[i + 1, :],
118129
facecolor=color,
119-
label= six.next(labels, None),
130+
label=six.next(labels, None),
120131
**kwargs))
121132
return r

0 commit comments

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