MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / stackplot

Function stackplot

lib/matplotlib/stackplot.py:17–143  ·  view source on GitHub ↗

Draw a stacked area plot or a streamgraph. Parameters ---------- x : (N,) array-like y : (M, N) array-like The data can be either stacked or unstacked. Each of the following calls is legal:: stackplot(x, y) # where y has shape (M, N) e.g. y = [y1,

(axes, x, *args,
              labels=(), colors=None, baseline='zero',
              **kwargs)

Source from the content-addressed store, hash-verified

15
16
17def stackplot(axes, x, *args,
18 labels=(), colors=None, baseline='zero',
19 **kwargs):
20 """
21 Draw a stacked area plot or a streamgraph.
22
23 Parameters
24 ----------
25 x : (N,) array-like
26
27 y : (M, N) array-like
28 The data can be either stacked or unstacked. Each of the following
29 calls is legal::
30
31 stackplot(x, y) # where y has shape (M, N) e.g. y = [y1, y2, y3, y4]
32 stackplot(x, y1, y2, y3, y4) # where y1, y2, y3, y4 have length N
33
34 baseline : {'zero', 'sym', 'wiggle', 'weighted_wiggle'}
35 Method used to calculate the baseline:
36
37 - ``'zero'``: Constant zero baseline, i.e. a simple stacked plot.
38 - ``'sym'``: Symmetric around zero and is sometimes called
39 'ThemeRiver'.
40 - ``'wiggle'``: Minimizes the sum of the squared slopes.
41 - ``'weighted_wiggle'``: Does the same but weights to account for
42 size of each layer. It is also called 'Streamgraph'-layout. More
43 details can be found at http://leebyron.com/streamgraph/.
44
45 labels : list of str, optional
46 A sequence of labels to assign to each data series. If unspecified,
47 then no labels will be applied to artists.
48
49 colors : list of :mpltype:`color`, optional
50 A sequence of colors to be cycled through and used to color the stacked
51 areas. The sequence need not be exactly the same length as the number
52 of provided *y*, in which case the colors will repeat from the
53 beginning.
54
55 If not specified, the colors from the Axes property cycle will be used.
56
57 data : indexable object, optional
58 DATA_PARAMETER_PLACEHOLDER
59
60 **kwargs
61 All other keyword arguments are passed to `.Axes.fill_between`. The
62 following parameters additionally accept a sequence of values
63 corresponding to the *y* datasets:
64
65 - *hatch*
66 - *edgecolor*
67 - *facecolor*
68 - *linewidth*
69 - *linestyle*
70
71 .. versionadded:: 3.9
72 Allowing a sequence of strings for *hatch*.
73
74 .. versionadded:: 3.11

Callers

nothing calls this directly

Calls 2

get_next_colorMethod · 0.45
fill_betweenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…