> For the complete documentation index, see [llms.txt](https://docs.shimoku.com/dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shimoku.com/dev/elements/charts/bar-charts/zero-centered-bar.md).

# Zero Centered Bar

The **zero centered bar** chart is used when you want to compare data against a value that can be set as zero, and the data values you have oscillate back and forth this value.

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

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

It must contain the following input variables:

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

And accepts the following input variables as optional:

```python
y: Optional[List[str]]
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]
```

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

### 1. Default Configuration <a href="#id-1.default-configuration" id="id-1.default-configuration"></a>

```python
data = [
    {'Name': 'a', 'y': 5},
    {'Name': 'b', 'y': -7},
    {'Name': 'c', 'y': 3},
    {'Name': 'd', 'y': -5},
]

s.plt.zero_centered_bar(
    data=data, x='Name', order=0,
)
```

![Zero centered bar chart in the default configuration.](/files/DmhxwPk7j0SdpKMxb0VW)

### &#x20;2. Customization And Context <a href="#id-2.-title-subtitle-axes-names-legend" id="id-2.-title-subtitle-axes-names-legend"></a>

It is possible to personalize the **title** of the chart, its **subtitle**, its **size** and add **padding**. One example could be obtained using:

```python
data = [
    {'Name': '0h', 'level': 2.6},
    {'Name': '3h', 'level': -3},
    {'Name': '6h', 'level': 3.2},
    {'Name': '9h', 'level': -2.9},
    {'Name': '12h', 'level': 3.6},
    {'Name': '15h', 'level': -3.4},
]

s.plt.zero_centered_bar(
    data=data, x='Name',
    order=0, rows_size=2, cols_size=7,
    padding='0,0,0,1', title='Tide level (m)',
)
```

![Note the space before the component with padding='0,0,0,1', the size with rows\_size=2, cols\_size=7,title='Tide level (m)', and subtitle='West Sector'. The menu\_path='zero-centered-bar-tide' was changed also.](/files/e9Vc0bkGEbnUbRCXi7aH)

## 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="/files/IK9aCYD45wW2A3kgHWyQ" alt=""><figcaption><p>variant="clean"</p></figcaption></figure>
{% endtab %}

{% tab title="Minimal" %}

<figure><img src="/files/FJjNgxRbLU2hbvf9D5df" alt=""><figcaption><p>variant="minimal"</p></figcaption></figure>
{% endtab %}

{% tab title="Thin" %}

<figure><img src="/files/ioVzBSWgRKwZ4AhzAuBU" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Clean Thin" %}

<figure><img src="/files/kCOo8Owwu1b42eIEiyqZ" alt=""><figcaption><p>variant="clean thin"</p></figcaption></figure>
{% endtab %}

{% tab title="Minimal Thin" %}

<figure><img src="/files/DnRtfA8FnHy6D8YXQqOg" alt=""><figcaption><p>variant="minimal thin"</p></figcaption></figure>
{% endtab %}

{% tab title="Shadow" %}

<figure><img src="/files/BgNt8q9HoEA6JHuNJ6uD" alt=""><figcaption><p>variant="shadow"</p></figcaption></figure>
{% endtab %}

{% tab title="Clean Shadow" %}

<figure><img src="/files/q0qZmSwKEQzFZy1M5svV" alt=""><figcaption><p>variant="clean shadow"</p></figcaption></figure>
{% endtab %}

{% tab title="Minimal Shadow" %}

<figure><img src="/files/CvTyae9SqdK8wJdjcmks" alt=""><figcaption><p>variant="minimal shadow"</p></figcaption></figure>
{% endtab %}
{% endtabs %}

{% hint style="info" %}

### Featured Content

[Changing the Menu Path](/dev/building-web-app/menu/changing-the-menu-path.md)\
The `menu_path` can be modified.<br>

[Using the Grid](/dev/building-web-app/grid/using-the-grid.md)

It is possible to use any number of rows.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.shimoku.com/dev/elements/charts/bar-charts/zero-centered-bar.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
