Top Bottom Line Charts

This chart combines two distinct line charts within the same visual container, each with its own y-axis, to facilitate the comparison of datasets with different scales. By presenting two datasets side by side, users can easily discern patterns, correlations, or contrasts between them without the scales interfering with the comparison. It's particularly valuable when showcasing data that, while related, operates on significantly different magnitudes or units.

The Method To Use

The method is s.plt.top_bottom_line().

It must contain the following input variables:

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

Accepts the following input variables as optional:

top_names: Optional[List[str]] = None, 
bottom_names: Optional[List[str]] = None,
rows_size: int = 4, 
cols_size: Optional[int] = None,
padding: Optional[str] = None, 
title: Optional[str] = None,
x_axis_name: Optional[str] = None, 
top_axis_name: Optional[str] = None,
bottom_axis_name: Optional[str] = None, 
option_modifications: Optional[Dict] = None

Examples

This is the .csv that will be used for the example:

The following code:

s.plt.top_bottom_line(
    data=pd.read_csv('Rainfall and flow.csv'), 
    order=0, x='Date',
    top_names=['flow'], bottom_names=['rainfall'],
    title='rainfall and flow', x_axis_name='Date',
    top_axis_name='flow(m³/s)', bottom_axis_name='rainfall(mm)'
)

Last updated