plot.dpart | R Documentation |
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
## S3 method for class 'dpart'
plot(x, y = NULL, node.cols = NULL,
keep.margins = FALSE, ...)
x |
object of class dpart. |
y |
NULL (not used) |
node.cols |
vector of colours with prey labels. Produced from the |
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 |
The keep.margins
should be left at the default. This argument is used
by the grab
function to make the plot visually appealing.
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.
dpart
, apc
, rpart
, plot.rpart
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.