Graph
Graph
A network graph.
Usage
from dataviz_mojo import graph
from dataviz_mojo.plot import save
def main() raises:
var from_people: List[String] = ["Alice", "Alice", "Bob", "Carol", "Dave"]
var to_people: List[String] = ["Bob", "Carol", "Dave", "Dave", "Eve"]
var connection_strength: List[Float64] = [8.0, 3.0, 5.0, 6.0, 4.0]
var c = graph(from_people, to_people, connection_strength)
save(c, "docs/src/examples/out_graph.svg")Args:
from_categories: Each edge’s source node, one entry per row.to_categories: Each edge’s destination node, one entry per row (paired withfrom_categories[i]).values: Each edge’s magnitude, sizing its connecting line; must be non-negative.theme: Full styling knobs beyond this function’s own parameters (colors, margins, fonts, gridlines, …) – seeTheme’s docstring.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 secondary line shown under the title.x_title: The x-axis caption.y_title: The y-axis caption.