Skip to content

Commit 5d722a9

Browse files
Simplify update to lib/matplotlib/stackplot.py
1 parent 8eb6289 commit 5d722a9

File tree

1 file changed

+10
-42
lines changed

1 file changed

+10
-42
lines changed

lib/matplotlib/stackplot.py

Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -23,53 +23,21 @@ def stackplot(axes, x, *args,
2323
2424
Parameters
2525
----------
26-
x : array-like
26+
x : (N, ) array-like
2727
28-
y : multiple array-like, 2D array-like or pandas.DataFrame
29-
30-
- multiple array-like: the data is unstacked
28+
y : (M, N) array-like or pandas.DataFrame
29+
The data is assumed to be unstacked. Each of the following
30+
calls is legal::
3131
32-
.. code-block:: none
32+
stackplot(x, y) # where y = [y1, y2, y3, y4]
33+
# or y = pd.DataFrame(np.random.random((4, 3)),
34+
# index=["category_A", "category_B", "category_C", "category_D"],
35+
# columns=["period_1", "period_2", "period_3"])
3336
34-
# year_1, year_2, year_3
35-
y1 = [value_1_A, value_2_A, value_3_A] # category_A
36-
y2 = [value_1_B, value_2_B, value_3_B] # category_B
37-
y3 = [value_1_C, value_2_C, value_3_C] # category_C
37+
stackplot(x, y1, y2, y3, y4) # where y1, y2, y3, y4 have length N
3838
39-
x = [*range(3)]
40-
41-
Example call:
42-
43-
.. code-block:: python
44-
45-
stackplot(x, y1, y2, y3)
46-
47-
- 2D array-like: Each row represents a category, each column represents an x-axis dimension associated with the categories. A list of 1D array-like can also be passed; each list item must have the same length
48-
49-
Example call:
50-
51-
.. code-block:: python
52-
53-
y = [y1, y2, y3]
54-
x = [*range(3)]
55-
56-
stackplot(x, y)
57-
58-
- a `pandas.DataFrame`: The index is used for the categories, each column represents an x-axis dimension associated with the categories.
59-
60-
Example call:
61-
62-
.. code-block:: python
63-
64-
y = pd.DataFrame(
65-
np.random.random((3, 3)),
66-
index=["category_A", "category_B", "category_C"],
67-
columns=[*range(3)]
68-
)
69-
70-
x = df.columns
39+
7140
72-
stackplot(x, y)
7341
7442
baseline : {'zero', 'sym', 'wiggle', 'weighted_wiggle'}
7543
Method used to calculate the baseline:

0 commit comments

Comments
 (0)