Illustrates trees to PNG files in the local directory.
Usage
illustrate_trees(
yarf_mod,
trees = NULL,
max_depth = -1,
background_rgb_color = c(255, 255, 255),
line_rgb_color = c(100, 100, 100),
text_rgb_color = c(0, 0, 0),
font_family = "Arial",
font_size = 12,
margin_in_px = 70,
character_width_in_px = 4.2,
length_in_px_per_half_split = 20,
depth_in_px_per_split = 100,
print_at_split_node_script = NULL,
print_at_leaf_script = NULL,
file_format = "png",
use_real_names = TRUE,
title = "yarf_mod_tree",
open_file = FALSE
)Arguments
- yarf_mod
The YARF model whose trees are to be illustrated
- trees
A vector of the tree indices (a subset of 1...num_trees)
- max_depth
Illustrate the tree only up to this depth. Default is
-1indicating no restriction.- background_rgb_color
A vector with 3 elements in
0, 1, ..., 255specifying the RGB color of the background. Default isc(255, 255, 255)for white.- line_rgb_color
A vector with 3 elements in
0, 1, ..., 255specifying the RGB color of the lines. Default isc(100, 100, 100)for grey.- text_rgb_color
A vector with 3 elements in
0, 1, ..., 255specifying the RGB color of the text. Default isc(0, 0, 0)for black.- font_family
The font family of the text in the illustration. This string is passed in as the first argument in a new
java.awt.Fontobject. You can find a list of legal arguments in the Java 8 documentation. Default isarial.- font_size
The font size in the illustrations in pixels. Default is
12.- margin_in_px
The margin in pixels of the entire illustration (equal on all sides). Default is
70.- character_width_in_px
Estimate as to the size of the character width in pixels. Differs based on fonts.
- length_in_px_per_half_split
The length of half of a split in pixels. Default is
20.- depth_in_px_per_split
The length of the depth of a split in pixels. Default is
100.- print_at_split_node_script
A custom javascript function which creates a special custom message to be printed at split nodes (see below). The default is
NULLwhich prints no special message.function printAtSplitNode(node){ //node is of type YARF.YARFNode
...
return message; //a string
}
- print_at_leaf_script
A custom javascript function which creates a special custom message to be printed at leaf nodes (see below). The default is
NULLwhich prints no special message.function printAtLeaf(node){ //node is of type YARF.YARFNode
...
return message; //a string
}
- file_format
The image format of the resulting illustration. Legal values are "jpg", "gif", "png". Default is "png".
- use_real_names
In the illustrations of split rules, set this to
TRUEto use the names in the data frame. andFALSEto use "X_1", "X_2", etc. Default isTRUE.- title
The name of the file. Note that "_00t.png" will be added where "t" is the tree index and "00" is an appropriate number of leading zeroes. Default is "yarf_mod_tree".
- open_file
Should the first file be opened by the operating system? Default is
FALSE.
