![]() |
|
Navigation |
Synopsis Tree layout.
Function
Figure tree(Figure root, Figures children, FProperty props...)
Description
tree takes a list of nodes and a list of edges and draws a tree.
The orientation property can be used to set the drawing direction, hgap and vgap can be used to set the gaps.
Examples
t1 = tree(box(fillColor("green")), [ box(fillColor("red")), box(fillColor("blue")) ], std(size(50)), std(gap(20)) ); render(t1); ![]() The standard way of drawing trees is in manhattan-style: all connection between tree nodes are horizontal or vertical. This style is controlled by the manhattan property: t2 = tree(box(fillColor("green")), [ box(fillColor("red")), box(fillColor("blue")) ], std(size(50)), std(gap(20)), manhattan(false) ); render(t2); ![]() t3 = tree(ellipse(size(30), fillColor("green")), [ tree(ellipse(size(45), fillColor("red")), [ ellipse(size(60), fillColor("blue")), ellipse(size(75), fillColor("purple")) ]), tree(ellipse(size(90), fillColor("lightblue")), [ box(size(30), fillColor("orange")), box(size(30), fillColor("brown")), box(size(30), fillColor("grey")), ellipse(size(30), fillColor("white")) ]), box(size(30), fillColor("black")) ], std(gap(30))); render(t3); ![]() ![]() |