## S3 method for class 'rpart':
plot(x, uniform = FALSE, branch = 1, compress = FALSE, nspace,
margin = 0, minbranch = 0.3, \dots)rpart, containing a classification,
regression, or rate tree.TRUE, uniform vertical spacing of the nodes is used; this may be
less cluttered when fitting a large plot onto a page.
The default is to use a non-uniform spacing proportional to the
error in the fit.FALSE, the leaf nodes will be at the horizontal plot coordinates of
1:nleaves.
If TRUE, the routine attempts a more compact arrangement of
the tree.
The compaction algorithm assumes uniform=TRUE; subranch.minbranch times the average
branch length. This parameter is ignored if uniform=TRUE.
Sometimes a split will give very little improvement, or even (in
the classification case) no improvemenx and y.In order to build up a plot in the usual S style, e.g., a separate text
command for adding labels, some extra information about the plot needs
be retained. This is kept in options("rpartplot"); there is no need
for this option to be retained from one R session to another, however.
plot, for objects
of class rpart.
The y-coordinate of the top node of the tree will always be 1.rpart, text.rpartfit <- rpart(Price ~ Mileage + Type + Country, cu.summary)
par(xpd = TRUE)
plot(fit, compress = TRUE)
text(fit, use.n = TRUE)Run the code above in your browser using DataLab