party (version 0.2-3)

Plot BinaryTree: Visualization of Binary Regression Trees

Description

This method plots objects of class BinaryTree.

Usage

## S3 method for class 'BinaryTree':
plot(x, main = NULL,
     type = c("extended", "simple"), terminal_panel = NULL,
     inner_panel = node_inner, edge_panel = edge_simple,
     drop_terminal = (type[1] == "extended"), 
     tnex = (type[1] == "extended") + 1, new = TRUE,  
     pop = FALSE, ...)

Arguments

x
an object of class BinaryTree.
main
an optional title for the plot.
type
a character specifying the complexity of the plot: extended tries to visualize the distribution of the response variable in each terminal node whereas simple only gives some summary i
terminal_panel
an optional panel function of the form function(node) plotting the terminal nodes. Alternatively, a panel generating function of the form function(ctreeobj, ...
inner_panel
an optional panel function of the form function(node) plotting the inner nodes.
edge_panel
an optional panel function of the form function(split, ordered = FALSE, left = TRUE) plotting the edges.
drop_terminal
a logical indicating whether all terminal nodes should be plotted at the bottom.
tnex
a numeric value giving the terminal node extention.
new
a logical indicating whether a new plot should be created.
pop
a logical whether the viewport tree should be popped before return.
...
additional arguments passed to callies.

Details

This plot method for BinaryTree objects provides an extensible framework for the visualization of binary regression trees. The user is allowed to specify panel functions for plotting terminal and inner nodes as well as the corresponding edges. Panel functions for plotting inner nodes, edges and terminal nodes are available for the most important cases and can serve as the basis for user-supplied extensions, see node_inner.

Examples

Run this code
data(airquality)
  airq <- subset(airquality, !is.na(Ozone))
  airct <- ctree(Ozone ~ ., data = airq)

  ### boxplots in each node
  plot(airct, terminal_panel = node_boxplot, drop_terminal = TRUE)

Run the code above in your browser using DataCamp Workspace