aryagraph.render.draw#

aryagraph.render.draw(g: Any, *, layout: Any = 'auto', seed: int = 0, layout_options: dict[str, Any] | None = None, node_color: Any = None, node_size: Any = None, node_shape: Any = None, node_opacity: Any = 1.0, labels: Any = 'auto', label_position: str = 'auto', label_size: float | None = None, label_max_width: float = 160, label_collisions: str = 'hide', tooltip: Any = None, edge_color: Any = None, edge_width: Any = None, edge_opacity: float | None = None, edge_style: str = 'auto', edge_label: Any = None, arrows: bool | None = None, arrow_size: float | None = None, curvature: float = 0.16, highlight: Any = None, highlight_path: Any = None, highlight_color: str | None = None, theme: Any = 'light', width: float | None = None, height: float | None = None, scale: float | None = None, padding: float | None = None, background: Any = None, title: str | None = None, subtitle: str | None = None, caption: str | None = None, legend: Any = 'auto', avoid_overlap: bool = True, base_size: float | None = None) → Figure[source]#

Draw a graph.

Every visual channel accepts a constant, an attribute name, a {node: value} mapping (e.g. the result of an algorithm), a callable, a sequence, or a aryagraph.by() spec. Data-driven channels get a legend automatically.

Parameters:
  • layout – "auto" (hierarchical for DAGs, stress otherwise), any name accepted by aryagraph.layout.compute(), a Layout, a {node: (x, y)} mapping, or a callable f(g) -> Layout.

  • node_color, node_size, node_shape, node_opacity – Node encodings. Categorical colors use the fixed-order palette and fold the tail into “Other”; numeric colors use a sequential scale; sizes map values to area.

  • labels – "auto" (all labels for ≤ 80 nodes, else the 30 most prominent), True/False, an int (top-k), or an attribute / mapping / callable giving the text. The label placer avoids overlaps and hides labels that cannot fit (label_collisions="show" keeps them).

  • label_position – "auto", "center" (inside the node), "right", "left", "above", "below" or a diagonal like "below-right".

  • edge_style – "auto", "straight", "curved", "flow" (S-curves along the hierarchy), "orthogonal", "spline".

  • highlight, highlight_path – Nodes/edges to emphasise (everything else is dimmed); a path is drawn along its consecutive edges.

  • theme – "light", "dark", "paper", "blueprint" or a Theme.

  • width, height – Display size; the drawing is fitted into it. Omit for natural size.