Bump
bump() over a long-form dataframe_mojo DataFrame (#743): one row per (series, category) pair, with value holding the rank or score at that step.
Usage
from dataviz import bump
from dataviz import save
from dataviz import Theme
def main() raises:
# Illustrative parcel volumes; bump converts each quarter's
# volumes to ranks, revealing overtakes rather than magnitudes.
var quarters: List[String] = ["Q1", "Q2", "Q3", "Q4", "Q5", "Q6"]
var carriers: List[String] = [
"SwiftShip", "ParcelPro", "Northstar", "MetroPost", "Relay",
]
var parcels_k: List[List[Int]] = [
[92, 96, 101, 108, 114, 121],
[108, 105, 103, 101, 99, 97],
[74, 82, 94, 106, 119, 128],
[88, 90, 89, 93, 96, 102],
[61, 68, 77, 85, 92, 105],
]
var c = bump(
quarters,
carriers,
parcels_k,
title="Illustrative Parcel-Carrier Rankings",
x_title="Quarter",
)
save(c, "docs/src/examples/out_bump.svg")See Data shapes for shared input conventions.
Args:
df: The frame to read.category: The string column naming each step along the x axis.series: The string column naming each line.value: The numeric column holding each point.theme: Full styling knobs beyond this function’s own parameters.width: Pixel width of the returnedPlot(.size()).height: Pixel height of the returnedPlot(.size()).title: The chart’s title, shown above the plot.subtitle: A line under the title.x_title: The x-axis caption; defaults tocategory.
Related
Related charts: Slope · Population Pyramid
Relevant API: bump