> For the complete documentation index, see [llms.txt](https://docs.tensorleap.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tensorleap.ai/tensorleap-integration/python-api/code_loader/visualizer_classes/leaphorizontalbar.md).

# LeapHorizontalBar

This object is used to visualize logits and histograms

```python
import numpy.typing as npt
from code_loader.contract.enums import LeapDataType

@dataclass
class LeapHorizontalBar:
    body: npt.NDArray[np.float32]
    labels: List[str]
    gt: Optional[npt.NDArray[np.float32]] = None
    type: LeapDataType = LeapDataType.HorizontalBar
```

<table><thead><tr><th width="167.39065467110788">Args</th><th></th></tr></thead><tbody><tr><td><code>body</code></td><td>np.ndarray float32 representation of the prediction confidences (length N) .</td></tr><tr><td><code>labels</code></td><td>a list of N strings representing the classes</td></tr><tr><td><code>gt</code></td><td>(optional) np.ndarray float32 representation of GT (length N).</td></tr></tbody></table>

## Examples

#### Basic Usage

```python
import numpy as np
from code_loader.contract.visualizer_classes import LeapHorizontalBar
from code_loader.contract.enums import LeapDataType
...


@tensorleap_custom_visualizer('label', visualizer_type=LeapDataType.HorizontalBar)
def animal_count_visualizer(num_of_cats: np.ndarray, num_of_dogs: np.ndarray) -> LeapHorizontalBar:
    body = [num_of_cats, num_of_dogs]
    labels = ['cats', 'dogs']
    return LeapHorizontalBar(body=body, labels=labels)
```


---

# 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.tensorleap.ai/tensorleap-integration/python-api/code_loader/visualizer_classes/leaphorizontalbar.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.
