Marked Line

A Marked Line Chart integrates specific markings or segments along the data line to highlight particular events, ranges, or important points. The shaded or colored regions in this chart type offer a quick visual reference, enabling users to identify significant periods or anomalies in the data. It's especially useful for emphasizing specific events or changes over a continuous dataset.

The Method To Use

The method is s.plt.marked_line().

It must contain the following input variables:

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

Accepts the following input variables as optional:

y: Optional[Union[List[str], str]] = None,
color_mark: str = 'rgba(255, 173, 177, 0.4)',
x_axis_name: Optional[str] = None, 
y_axis_name: Optional[str] = None,
title: Optional[str] = None, 
rows_size: Optional[int] = None, 
cols_size: Optional[int] = None,
padding: Optional[List[int]] = None, 
show_values: Optional[List[str]] = None,
option_modifications: Optional[Dict] = None, 
variant: Optional[str] = None

Examples

The following code:

data = [
    {'date': dt.date(2021, 1, 1), 'x': 5, 'y': 5},
    {'date': dt.date(2021, 1, 2), 'x': 6, 'y': 5},
    {'date': dt.date(2021, 1, 3), 'x': 4, 'y': 5},
    {'date': dt.date(2021, 1, 4), 'x': 7, 'y': 5},
    {'date': dt.date(2021, 1, 5), 'x': 3, 'y': 5},
]
s.plt.marked_line(
    data=data, x='date',
    marks=[('first segment', 0, 1), ('second segment', 2, 3)],
    order=0, rows_size=2, cols_size=12, y=['x', 'y']
)

Variants

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

Last updated