plot.dpart: Plot of the diet classification tree

View source: R/plot.dpart.R

plot.dpartR Documentation

Plot of the diet classification tree

Description

The function produces a plot of the classification tree with terminal nodes coloured according to the node colours provided. If node.cols is NULL, the standard classification tree is produced.

@aliases plot

Usage

## S3 method for class 'dpart'
plot(x, y = NULL, node.cols = NULL,
  keep.margins = FALSE, ...)

Arguments

x

object of class dpart.

y

NULL (not used)

node.cols

vector of colours with prey labels. Produced from the apc function.

keep.margins

logical. Whether to keep the same plotting margins (TRUE) or reset them back to the default (FALSE). (Default: FALSE)

...

arguments to be passed to or from other methods

Details

The keep.margins should be left at the default. This argument is used by the grab function to make the plot visually appealing.

References

Kuhnert, P.M., Duffy, L. M and Olson, R.J. (2012) The Analysis of Predator Diet and Stable Isotope Data, Journal of Statistical Software, In Prep.

See Also

dpart, apc, rpart, plot.rpart

Examples

# Load data
#data(yftdiet)  
 
# Load the prey taxa data
#data(PreyTaxonSort)
 
# Assigning prey colours for default palette
#val <- apc(x = yftdiet, preyfile = PreyTaxonSort, check = TRUE)
#node.colsY <- val$cols
#dietPP <- val$x   # updated diet matrix with Group assigned prey taxa codes
 
# Fitting the classification tree
#yft.dp <- dpart(Group ~ Lat + Lon + Year + Quarter + SST  + Length, 
#                    data = dietPP, weights = W, minsplit = 10, cp = 0.001)
# plot(yft.dp, node.cols = node.colsY)
                   

pkuhnert/diet documentation built on June 10, 2025, 2:59 a.m.