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

The method is s.plt.stacked_area()

It must contain the following parameters:

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

and accepts these parameters as optional:

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

The following code:

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',
)

Variants

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

Last updated