tree2dot: Write tree to dot file.

Description Usage Arguments Details Value See Also Examples

Description

Write tree to dot file. This is basically a wrapper around the print.tree function that writes the dot format representation of the given tree to a file for later conversion into a picture using tools from the open source graph visualization software Graphviz (www.graphviz.org).

Usage

1
tree2dot(tree, filename, ...)

Arguments

tree

Tree object.

filename

Name of output file.

...

Arguments passed to print.tree like ‘nodef’ and ‘edgef’.

Details

You can change the way your trees are annotated by passing your own functions for printing dot format node and edge attributes to tree2dot via arguments ‘nodef’ and ‘edgef’ that get passed to print.tree.

Value

Produces a file in dot format that can be converted into a picture using tools from the open source graph visualization software Graphviz (www.graphviz.org). For example, to convert the file ‘foo.dot’ into the png file ‘foo.dot.png’ you could run ‘dot -Tpng -O foo.dot’ from the command line.

See Also

make_tree

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
library(treeFun)

d <- read.table(textConnection("\
id parents label
0 - a
1 0 b
2 0 c
3 1 d
4 1 e
5 1 f
6 2 g
7 2 h
8 7 i
"), header = TRUE, stringsAsFactors = FALSE)

##         0a
##        / \
##      /     \
##    1b       2c
##   /|\      / \
##  / | \    /   \
## 3d 4e 5f 6g    7h
##                 \
##                  \
##                   8i

## Not run: tree2dot(make_tree(d), "tree.dot")

cbaumbach/treeFun documentation built on May 13, 2019, 1:49 p.m.