Graph
graph() over named columns of a dataframe_mojo DataFrame (#743). Each argument names a column instead of holding the values.
Usage
from dataviz import graph
from dataviz import save
def main() raises:
# Illustrative weekly pallet movements through a distribution network.
var origin: List[String] = [
"North Plant", "South Plant", "North Plant", "South Plant",
"Central Hub", "Central Hub", "Coastal Hub", "Coastal Hub",
"Metro DC", "Metro DC", "Regional DC", "Regional DC",
]
var destination: List[String] = [
"Central Hub", "Central Hub", "Coastal Hub", "Coastal Hub",
"Metro DC", "Regional DC", "Metro DC", "Port DC",
"City Stores", "Airport Stores", "Town Stores", "Rural Stores",
]
var pallets: List[Int] = [
420, 360, 190, 240, 310, 270, 225, 180, 205, 95, 175, 120,
]
var c = graph(
origin,
destination,
pallets,
title="Illustrative Weekly Distribution Network",
)
save(c, "docs/src/examples/out_graph.svg")See Data shapes for shared input conventions.
Args:
df: The frame to read.from_categories: The string column for this channel.to_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.layout: See the list overload.
Related
Related charts: Arc Diagram · Sankey
Relevant API: graph