LeapHorizontalBar

code_loader.contract.visualizer_classes.LeapHorizontalBar

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

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

Examples

Basic Usage

import numpy as np
from code_loader.contract.visualizer_classes import LeapHorizontalBar
from code_loader import leap_binder
...

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)
    
leap_binder.set_visualizer(
    name='animal_count',
    function=animal_count_visualizer,
    visualizer_type=LeapHorizontalBar.type
)

Last updated