plot_tree: Plot Decision Tree Function

Description Usage Arguments Examples

View source: R/plot_tree.R

Description

This function creates a plot of the decision tree with customizable appearance.

Usage

1
2
3
4
5
plot_tree(tree, edge.label.display = "both",
  vertex.label.display = "end", edge.label.position = 0.33,
  vertex.size = 7, font.size = 3, plot.padding = "auto",
  color.root = "yellow", color.internal = "green", color.end = "red",
  theme = FALSE)

Arguments

tree

a decision tree/tree object generated by create_tree()

edge.label.display

edge label mode, options: - "all","both": concatenate edge names and probabilities (default) - "label": show edge names only - "probability": show edge probabilities only - "none": don't show edge labels

vertex.label.display

vertex label mode, options: - "all": show labels for all vertices - "end": show labels only for end vertices (default) - "none": don't show vertex labels

edge.label.position

how far along the edge's straight part to display the label ([0-1], default = 0.33)

vertex.size

size of vertices in mm (default = 7)

font.size

font size in edge and vertex labels (default = 3)

plot.padding

left and right padding to add to the plot, options: - "auto": automatically set based on font size and max label length (default) - c(left, right): manually set based on provided vector

color.root

color of the root node (default = "yellow")

color.internal

color of internal, i.e. not root or end nodes (default = "green")

color.end

color of the end nodes (default = "red")

theme

theme to apply to the final plot (default = empty) refer to https://ggplot2.tidyverse.org/reference/theme.html for more on ggplot2 themes

Examples

1
tree <- plot_tree(read.csv("branches.csv"))

DARTH-git/Dectree documentation built on Feb. 6, 2020, 6:57 p.m.