# 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 <a href="#the-method-to-use.1" id="the-method-to-use.1"></a>

The method is `s.plt.top_bottom_line()`.

It must contain the following input variables:

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

Accepts the following input variables as optional:

```python
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 <a href="#examples" id="examples"></a>

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

{% file src="<https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2FHHINQMR7i6zQPfcd7TVe%2FRainfall%20and%20flow.csv?alt=media&token=e9cf0b0a-cef2-4562-a28a-2d8f987f814f>" %}

The following code:

```python
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)'
)
```

<figure><img src="https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2FH7UC8GeUlvb9jXxPbUx3%2FTop%20bottom.png?alt=media&#x26;token=73700091-d1ab-420a-8a2c-aa377199b10c" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shimoku.com/dev/elements/charts/line-charts/top-bottom-line-charts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
