Function Reference
— Function File: treeplot (Tree)
— Function File: treeplot (Tree, LineStyle, EdgeStyle)

Produces a graph of tree or forest. The first argument is vector of predecessors, optional parameters LineStyle and EdgeStyle define the output style. The complexity of the algorithm is O(n) in terms of is time and memory requirements.

See also: etreeplot gplot

Demonstration 1

The following code

 % Plot a simple tree plot 
 treeplot([2 4 2 0 6 4 6])

Produces the following figure

Demonstration 2

The following code

 % Plot a simple tree plot defining the edge and node styles
 treeplot([2 4 2 0 6 4 6], "b+", "g") 

Produces the following figure