Predictive Line

A forecasting or predictive line chart consists of a basic trend line for all data up until the current date/time, along with a forecast line showing predicted changes beyond the current date/time.

The Method To Use

The method is s.plt.predictive_line().

It must contain the following input variables:

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

Accepts the following input variables as optional:

y: Optional[Union[List[str], str]]
min_value_mark: Optional[str] 
max_value_mark: Optional[str]
color_mark: str
data: Union[List[str], DataFrame, List[Dict]]
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

1. Default Configuration

data = [
    {'date': dt.date(2021, 1, 1), 'x': 4, 'y': 5},
    {'date': dt.date(2021, 1, 2), 'x': 7, 'y': 6},
    {'date': dt.date(2021, 1, 3), 'x': 4, 'y': 7},
    {'date': dt.date(2021, 1, 4), 'x': 9, 'y': 8},
    {'date': dt.date(2021, 1, 5), 'x': 3, 'y': 9},
]

s.plt.predictive_line(
    data=data, x='date', order=0,
    min_value_mark=3, max_value_mark=4,
    rows_size=2, cols_size=12,
)

2. Customization And Context

It is possible to personalize the title of the chart, name of each axis, the legend, size and add padding. One example could be obtained using:

data = [
    {'date': dt.date(2021, 1, 1), 'gas': 4, 'oil': 5},
    {'date': dt.date(2021, 1, 2), 'gas': 7, 'oil': 6},
    {'date': dt.date(2021, 1, 3), 'gas': 4, 'oil': 7},
    {'date': dt.date(2021, 1, 4), 'gas': 9, 'oil': 5},
    {'date': dt.date(2021, 1, 5), 'gas': 3, 'oil': 9},
    {'date': dt.date(2021, 1, 6), 'gas': 6, 'oil': 5},
    {'date': dt.date(2021, 1, 7), 'gas': 8, 'oil': 6},
]

s.plt.predictive_line(
    data=data, x='date', order=0,
    min_value_mark=3, max_value_mark=4,
    rows_size=2, cols_size=12, padding='0,0,0,1',
    title='Fossil price evolution - first days 2021.'
)

Variants

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

Changing the Menu Path The menu_path can be modified.

Using the Grid

It is possible to use any number of rows.

Last updated