Line With Confidence Area

The line with confidence area presents a data trend alongside a shaded region that represents the variability or uncertainty of the data. This shaded region, often termed the 'confidence interval' or 'confidence band', gives an idea of the reliability of predictions or the possible range within which the actual values may lie. It is instrumental in scenarios where it's vital to understand the degree of certainty or risk associated with the data points.

The Method To Use

The method is s.plt.line_with_confidence_area().

It must contain the following input variables:

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

Accepts the following input variables as optional:

rows_size: Optional[int] = None
cols_size: Optional[int] = None,
padding: Optional[str] = None
title: Optional[str] = None,
x_axis_name: Optional[str] = None
y_axis_name: Optional[str] = None,
percentages: bool = False
option_modifications: Optional[Dict] = None
variant: Optional[str] = None

Examples

The following code:

confidence_data = requests.get(url='https://echarts.apache.org/examples/data/'
                                   'asset/data/confidence-band.json').json()
for dat in confidence_data:
    dat['value'] = dat['value'] * 100
    dat['l'] = dat['l'] * 100
    dat['u'] = dat['u'] * 100

s.plt.line_with_confidence_area(
    data=confidence_data, order=0,
    title='Confidence Band Chart',
    x='date', y='value', 
    lower='l', upper='u',
    x_axis_name='Date',
    y_axis_name='Value',
    percentages=True,
)

Variants

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

Last updated