> 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/horizontal-bar.md).

# Horizontal Bar

The **horizontal bar chart** can display the category labels in a natural, easy-to-read manner. If the labels are long they will not overlap. The data can be plotted horizontally, meaning that the longer the bar the larger the category. This is a good way to present data with long labels that would be hard to display below a vertical bar.

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

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

It must contain the following input variables:

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

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]
variant: Optional[str]
```

## 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': 'd', 'y': 6, 'z': 3},
    {'Name': 'c', 'y': 7, 'z': 1},
    {'Name': 'b', 'y': 3, 'z': 5},
    {'Name': 'a', 'y': 5, 'z': 6},
]

s.plt.horizontal_bar(
    data=data, x='Name', order=0,
    rows_size=2, cols_size=12,
)
```

![The horizontal bar chart in the default configuration.](/files/folADJRUOMYCZiSqU5Zc)

### 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**, name of each **axis**, the **legend,** its **size** and add **padding**. One example could be obtained using:

```python
data = [
    {'Count': 'Ph 1', 'Hours': 6, 'People': 3},
    {'Count': 'Ph 2', 'Hours': 7, 'People': 1},
    {'Count': 'Ph 3', 'Hours': 3, 'People': 5},
    {'Count': 'Ph 4', 'Hours': 5, 'People': 6},
]

s.plt.horizontal_bar(
    data=data, x='Count', 
    order=0, rows_size=2, cols_size=10,
    padding='0,0,0,1', title='Working Hours and Resources',
)
```

![The horizontal bar chart is fully customized, note the space before the component using padding='0,0,0,1' and size using cols\_size=10.](/files/t5keeuKcq5lzy90DQYn6)

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

{% tab title="Minimal" %}

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

{% tab title="Thin" %}

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

{% tab title="Clean Thin" %}

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

{% tab title="Minimal Thin" %}

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

{% tab title="Shadow" %}

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

{% tab title="Clean Shadow" %}

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

{% tab title="Minimal Shadow" %}

<figure><img src="/files/ACeNQ9GLbqAMTpTC4nz3" 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/horizontal-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.
