Shimoku docs
Search…
Predictive line chart
A forecasting or predictive line chart consists of a basic trendline 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 shimoku.plt.predictive_line()
It must contain the following input variables:
data: Union[str, DataFrame, List[Dict]]
x: str
y: List[str]
menu_path: str
order: int
Accepts the following input variables as optional:
title: Optional[str]
x_axis_name: Optional[str]
y_axis_name: Optional[str]
rows_size: Optional[int]
cols_size: Optional[int]
padding: Optional[List[int]]
And it may be personalized with the input variables:
option_modifications: Optional[Dict]

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},
]
shimoku.plt.predictive_line(
data=data,
x='date', y=['x', 'y'],
min_value_mark=dt.date(2021, 1, 4).isoformat(),
max_value_mark=dt.date(2021, 1, 5).isoformat(),
menu_path='test/predictive-line-1',
order=0,
rows_size=2, cols_size=12,
)
The result is:

2. Title, axes names, legend, size and padding

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},
]
shimoku.plt.predictive_line(
data=data,
x='date', y=['gas', 'oil'],
min_value_mark=dt.date(2021, 1, 5).isoformat(),
max_value_mark=dt.date(2021, 1, 7).isoformat(),
menu_path='test/predictive-line-2',
order=0,
rows_size=2, cols_size=12,
padding='0,0,0,1',
title='Fossil price evolution - first days 2021.'
)
The result is:
The predictive line chart is completely personalized. Note the space before the component with padding='0,0,0,1'.
Changing menu_path The menu_path can be modified.
It is possible to use any number of rows.
Last modified 4mo ago
Copy link
On this page
The method to use
Examples
1. Default configuration
2. Title, axes names, legend, size and padding
Featured content