Skip to content

Lollipop

lollipop() over named columns of a dataframe_mojo DataFrame (#743). Each argument names a column instead of holding the values. The axis titles default to the categories and values column names.

Lollipop

Usage

from dataviz import lollipop
from dataviz import save
from dataviz import Theme
from dataviz.core.colors import TEAL

def main() raises:
    var countries: List[String] = [
        "USA", "China", "Japan", "Germany", "India",
        "UK", "France", "Italy", "Brazil", "Canada",
    ]
    # Rounded illustrative totals in trillions of US dollars.
    var gdp: List[Float64] = [27.4, 17.8, 4.2, 4.1, 3.7, 3.3, 3.0, 2.2, 2.1, 2.1]

    var c = lollipop(
        countries,
        gdp,
        title="Illustrative Nominal GDP by Economy",
        x_title="Economy",
        y_title="Nominal GDP (US$ trillions)",
        theme=Theme(mark_color=TEAL),
    )
    save(c, "docs/src/examples/out_lollipop.svg")

See Data shapes for shared input conventions.

Args:

  • df: The frame to read.
  • categories: The string column for this channel.
  • values: The numeric column for this channel.
  • theme: See the list overload.
  • width: See the list overload.
  • height: See the list overload.
  • title: See the list overload.
  • subtitle: See the list overload.
  • x_title: See the list overload.
  • y_title: See the list overload.
  • horizontal: See the list overload.

Related

Related charts: Grouped Bar

Relevant API: lollipop