Repository: matplotlib/matplotlib
File: lib/matplotlib/stackplot.py (Python)

Code before:

    colors : list of :mpltype:`color`, optional
        A sequence of colors to be cycled through and used to color the stacked
        areas. The sequence need not be exactly the same length as the number
        of provided *y*, in which case the colors will repeat from the
        beginning.

        If not specified, the colors from the Axes property cycle will be used.

    data : indexable object, optional
        DATA_PARAMETER_PLACEHOLDER

    **kwargs
        All other keyword arguments are passed to `.Axes.fill_between`.  The
            following parameters additionally accept a sequence of values
            corresponding to the *y* datasets:

            - *hatch*

            .. versionadded:: 3.9
               Allowing a sequence of strings for *hatch*.

            - *edgecolor*
            - *facecolor*
            - *linewidth*
            - *linestyle*

            .. versionadded:: 3.11
               Allowing sequences of values in above listed `.Axes.fill_between`
               parameters.

    Returns
    -------
    list of `.PolyCollection`
        A list of `.PolyCollection` instances, one for each element in the
        stacked area plot.
    """

    y = np.vstack(args)

    labels = iter(labels)
    if colors is None:
        colors = [axes._get_lines.get_next_color() for _ in y]

    kwargs = cbook.normalize_kwargs(kwargs, collections.PolyCollection)
    kwargs.setdefault('facecolor', colors)

    kwargs, style_gen = _style_helpers.style_generator(kwargs)

    # Assume data passed has not been 'stacked', so stack it here.
    # We'll need a float buffer for the upcoming calculations.

Review comment (suggestion):
Let's move all supported paramters into a single list and group the versionadded information below. Rationale: The current state is more important than the history; so primarily list the current state and explain all history afterwards. It's too distracting to have the versionadded sprinkled in between. The only alternative would be to put this into each bullet item, but then you'd have to add it to every element.

```suggestion
            - *edgecolor*
            - *facecolor*
            - *linewidth*
            - *linestyle*

            .. versionadded:: 3.9
               Allowing a sequence of strings for *hatch*.
```

Code after:

    colors : list of :mpltype:`color`, optional
        A sequence of colors to be cycled through and used to color the stacked
        areas. The sequence need not be exactly the same length as the number
        of provided *y*, in which case the colors will repeat from the
        beginning.

        If not specified, the colors from the Axes property cycle will be used.

    data : indexable object, optional
        DATA_PARAMETER_PLACEHOLDER

    **kwargs
        All other keyword arguments are passed to `.Axes.fill_between`.  The
            following parameters additionally accept a sequence of values
            corresponding to the *y* datasets:

            - *hatch*
            - *edgecolor*
            - *facecolor*
            - *linewidth*
            - *linestyle*

            .. versionadded:: 3.9
               Allowing a sequence of strings for *hatch*.

            .. versionadded:: 3.11
               Allowing sequences of values in above listed `.Axes.fill_between`
               parameters.

    Returns
    -------
    list of `.PolyCollection`
        A list of `.PolyCollection` instances, one for each element in the
        stacked area plot.
    """

    y = np.vstack(args)

    labels = iter(labels)
    if colors is None:
        colors = [axes._get_lines.get_next_color() for _ in y]

    kwargs = cbook.normalize_kwargs(kwargs, collections.PolyCollection)
    kwargs.setdefault('facecolor', colors)

    kwargs, style_gen = _style_helpers.style_generator(kwargs)

    # Assume data passed has not been 'stacked', so stack it here.
    # We'll need a float buffer for the upcoming calculations.
    stack = np.cumsum(y, axis=0, dtype=np.promote_types(y.dtype, np.float32))