Skip to content
Numeric Types

Numeric Types

Use this when: You need to plot List[Int]/List[Float32] data directly.

Numeric Types

Usage

from dataviz import Plot, save
from dataviz.core.theme import Theme


def main() raises:
    var quarters: List[String] = ["Q1", "Q2", "Q3", "Q4"]
    var units_sold: List[Int] = [420, 385, 510, 601]

    var plot = (
        Plot()
        .mark_bar()
        .encode_categorical(x=quarters, y=units_sold)
        .theme(Theme(show_data_labels=True))
        .labels(title="Units Sold (List[Int])", y_title="Units")
    )
    save(plot, "docs/src/examples/out_numeric_types.svg")

Related

Related recipes: Grouped DataFrame Facets · NumPy and pandas Data

Relevant API: Data shapes