# Line and Bar

This hybrid chart fuses the visual appeal of both line and bar graphs. While the line graph depicts the trend or continuous data, the bars offer a clear representation of discrete data points. The dual y-axis design facilitates the comparison of two related but differently scaled sets of data. This configuration is especially helpful when one wants to showcase a correlation or interaction between two distinct yet interconnected data sets.

## The Method To Use <a href="#the-method-to-use" id="the-method-to-use"></a>

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

It must contain the following input variables:

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

And accepts the following input variables as optional:

```python
bar_names: Optional[List[str]] = None
line_names: Optional[List[str]] = None
x_axis_name: Optional[str] = None
bar_axis_name: Optional[str] = None
bar_suffix: Optional[str] = None,
line_axis_name: Optional[str] = None
line_suffix: Optional[str] = None
title: Optional[str] = None
rows_size: Optional[int] = None
cols_size: Optional[int] = None
padding: Optional[List[int]] = None
option_modifications: Optional[Dict] = None
variant: Optional[str] = None
```

## Examples <a href="#examples" id="examples"></a>

The following code:

```python
data = [
    {'day': 'Mon', 'Evaporation': 2.0, 'Precipitation': 2.6, 'Temperature': 2.0},
    {'day': 'Tue', 'Evaporation': 4.9, 'Precipitation': 5.9, 'Temperature': 2.2},
    {'day': 'Wed', 'Evaporation': 7.0, 'Precipitation': 9.0, 'Temperature': 3.3},
    {'day': 'Thu', 'Evaporation': 23.2, 'Precipitation': 26.4, 'Temperature': 4.5},
    {'day': 'Fri', 'Evaporation': 25.6, 'Precipitation': 28.7, 'Temperature': 6.3},
    {'day': 'Sat', 'Evaporation': 76.7, 'Precipitation': 70.7, 'Temperature': 10.2},
    {'day': 'Sun', 'Evaporation': 135.6, 'Precipitation': 175.6, 'Temperature': 20.3}
]

s.plt.line_and_bar_charts(
    data=data, order=0, x='day', 
    bar_names=['Evaporation', 'Precipitation'], 
    line_names=['Temperature'],
    title='rainfall and temperature', 
    x_axis_name='Day', 
    line_axis_name='Temperature',
    line_suffix=' °C', 
    bar_axis_name='Evaporation and precipitacion', 
    bar_suffix=' ml'
)
```

<figure><img src="https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2F30IeKxurGrV2A9FmNFIB%2FBar%20And%20Line.png?alt=media&#x26;token=3f90d7d8-9d0b-43f9-abaf-32dfd9285f2b" alt=""><figcaption></figcaption></figure>

## Variants

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

{% tabs %}
{% tab title="Clean" %}

<figure><img src="https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2FU5Rn7dPn1FoGBvzOofG5%2Fimatge.png?alt=media&#x26;token=4bded191-530d-4c81-9831-d95b8fd5c21c" alt=""><figcaption><p>variant="clean"</p></figcaption></figure>
{% endtab %}

{% tab title="Minimal" %}

<figure><img src="https://3782181538-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUlHTfmIZY46Z1EDfyGMz%2Fuploads%2FqPKz49V1HJctdohaBS1M%2Fimatge.png?alt=media&#x26;token=cdb251ee-9829-463f-9552-9167220c172c" alt=""><figcaption><p>variant="minimal"</p></figcaption></figure>
{% endtab %}
{% endtabs %}

##


---

# 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-and-bar.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.
