pyiron_workflow.draw module

Functions for drawing the graph.

class pyiron_workflow.draw.DataChannel(parent: _IO, channel: WorkflowChannelType, local_name: str)[source]

Bases: _Channel[WorkflowDataChannel]

property color: str
property shape: str
property style: str
class pyiron_workflow.draw.Inputs(parent: Node)[source]

Bases: _IO

property gradient_angle: str

Background fill colour angle in degrees

class pyiron_workflow.draw.Node(node: WorkflowNode, parent: Node | None = None, depth: int = 1, rankdir: Literal['LR', 'TB'] = 'LR', size: str | None = None)[source]

Bases: WorkflowGraphvizMap

A wrapper class to connect graphviz to our workflow nodes. The nodes are represented by a “graph” or “subgraph” in graphviz parlance (depending on whether the node being visualized is the top-most node or not).

Visualized nodes show their label and type, and IO panels with label and type. Colors and shapes are exploited to differentiate various node classes, input/output, and data/signal channels.

If the node is composite in nature and the depth argument is at least 1, owned children are also visualized (recursively with depth = depth - 1) inside the scope of this node.

Parameters:
  • node (pyiron_workflow.node.Node) – The node to visualize.

  • parent (Optional[pyiron_workflow.draw.Node]) – The visualization that owns this visualization (if any).

  • depth (int) – How deeply to decompose any child nodes beyond showing their IO.

  • rankdir ("LR" | "TB") – Use left-right or top-bottom graphviz rankdir.

  • size (tuple[int | float, int | float] | None) – The size of the diagram, in inches(?); respects ratio by scaling until at least one dimension matches the requested size. (Default is None, automatically size.)

build_node_name(suffix='')[source]
property color: str
property fillcolor: str
property graph: Digraph
property label: str
property name: str
property parent: Node | None
property style: str
class pyiron_workflow.draw.Outputs(parent: Node)[source]

Bases: _IO

property gradient_angle: str

Background fill colour angle in degrees

class pyiron_workflow.draw.SignalChannel(parent: _IO, channel: WorkflowChannelType, local_name: str)[source]

Bases: _Channel[WorkflowSignalChannel]

property color: str
property shape: str
class pyiron_workflow.draw.WorkflowGraphvizMap[source]

Bases: ABC

A parent class defining the interface for the graphviz representation of all our workflow objects.

abstract property color: str
abstract property graph: Digraph
abstract property label: str
abstract property name: str
abstract property parent: WorkflowGraphvizMap | None
pyiron_workflow.draw.blend_colours(color_a, color_b, fraction_a=0.5)[source]

Blends two hex code colours together

pyiron_workflow.draw.directed_graph(name, label, rankdir, color_start, color_end, gradient_angle, size=None, style='filled', fillcolor_start=None, fillcolor_end=None)[source]

A shortcut method for instantiating the type of graphviz graph we want

pyiron_workflow.draw.lighten_hex_color(color, lightness=0.7)[source]

Blends the given hex code color with pure white.

pyiron_workflow.draw.reverse_rankdir(rankdir: Literal['LR', 'TB'])[source]