# Stacked Area

A Stacked Area Chart is an extension of the basic Area Chart, where multiple datasets are layered on top of one another, showcasing the cumulative contribution of each dataset to the total. Each distinct color or shade represents a different data category, allowing for easy visual differentiation. It's particularly useful for displaying the composition and relative proportion of multiple data series over time.

### The Method To Use <a href="#the-method-to-use" id="the-method-to-use"></a>

The method is `s.plt.stacked_area()`

It must contain the following parameters:

```python
x: str
order: int
data: Union[str, DataFrame, List[Dict]]
```

and accepts these parameters as optional:

```python
y: Optional[Union[List[str], str]]
x_axis_name: Optional[str]
y_axis_name: Optional[str]
title: Optional[str]
rows_size: Optional[int]
cols_size: Optional[int]
padding: Optional[List[int]]
show_values: Optional[List[str]]
option_modifications: Optional[Dict]
variant: Optional[str]
```

## Examples <a href="#examples" id="examples"></a>

The following code:

```python
data = [
    {'Weekday': 'Mon', 'Email': 120, 'Union Ads': 132, 'Video Ads': 101, 'Search Engine': 134},
    {'Weekday': 'Tue', 'Email': 220, 'Union Ads': 182, 'Video Ads': 191, 'Search Engine': 234},
    {'Weekday': 'Wed', 'Email': 150, 'Union Ads': 232, 'Video Ads': 201, 'Search Engine': 154},
    {'Weekday': 'Thu', 'Email': 820, 'Union Ads': 932, 'Video Ads': 901, 'Search Engine': 934},
    {'Weekday': 'Fri', 'Email': 120, 'Union Ads': 132, 'Video Ads': 101, 'Search Engine': 134},
    {'Weekday': 'Sat', 'Email': 220, 'Union Ads': 182, 'Video Ads': 191, 'Search Engine': 234},
    {'Weekday': 'Sun', 'Email': 150, 'Union Ads': 232, 'Video Ads': 201, 'Search Engine': 154},
]

s.plt.stacked_area(
    data=data, x="Weekday", order=0,
    x_axis_name='Visits per weekday',
)
```

<figure><img src="https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2FVzNC5DrGFuBzWfudIouJ%2FStacked%20Area.png?alt=media&#x26;token=49bbf030-3a17-4ec9-8663-a571faaaa393" alt=""><figcaption><p>Stacked area chart</p></figcaption></figure>

## Variants

By setting the parameter `variant` to the following values the appearance of the chart can be changed:

{% tabs %}
{% tab title="Clean" %}

<figure><img src="https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2FUD1caghtKDEkAo3eudYp%2Fimatge.png?alt=media&#x26;token=69493c59-0bb3-4f19-a8e3-c8ef2ab74269" alt=""><figcaption><p>variant="clean"</p></figcaption></figure>
{% endtab %}

{% tab title="Minimal" %}

<figure><img src="https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2FiLDQWXo9v8yJHffMKIaE%2Fimatge.png?alt=media&#x26;token=85205d05-e92c-4c40-a6f5-ab6e7618d22f" alt=""><figcaption><p>variant="minimal"</p></figcaption></figure>
{% endtab %}
{% endtabs %}
