post.rpart: PostScript Presentation Plot of an Rpart Object

View source: R/post.rpart.R

post.rpartR Documentation

PostScript Presentation Plot of an Rpart Object


Generates a PostScript presentation plot of an rpart object.


post(tree, ...)

## S3 method for class 'rpart'
post(tree, title., 
     filename = paste(deparse(substitute(tree)), ".ps", sep = ""), 
     digits = getOption("digits") - 2, pretty = TRUE,
     use.n = TRUE, horizontal = TRUE, ...)



fitted model object of class "rpart". This is assumed to be the result of some function that produces an object with the same named components as that returned by the rpart function.


a title which appears at the top of the plot. By default, the name of the rpart endpoint is printed out.


ASCII file to contain the output. By default, the name of the file is the name of the object given by rpart (with the suffix .ps added). If filename = "", the plot appears on the current graphical device.


number of significant digits to include in numerical data.


an integer denoting the extent to which factor levels will be abbreviated in the character strings defining the splits; (0) signifies no abbreviation of levels. A NULL signifies using elements of letters to represent the different factor levels. The default (TRUE) indicates the maximum possible abbreviation.


Logical. If TRUE (default), adds to the label ⁠#events level1/ #events level2/⁠ etc. for method class, ⁠n⁠ for method anova, and ⁠#events/n⁠ for methods poisson and exp).


Logical. If TRUE (default), plot is horizontal. If FALSE, plot appears as landscape.


other arguments to the postscript function.


The plot created uses the functions plot.rpart and text.rpart (with the fancy option). The settings were chosen because they looked good to us, but other options may be better, depending on the rpart object. Users are encouraged to write their own function containing favorite options.

Side Effects

a plot of rpart is created using the postscript driver, or the current device if filename = "".

See Also

plot.rpart, rpart, text.rpart, abbreviate


## Not run: <- rpart(Mileage ~ Weight, car.test.frame)
post(, file = "")   # display tree on active device
   # now construct postscript version on file ""
   # with no title
post(, file = "", title = " ")
z.hp <- rpart(Mileage ~ Weight + HP, car.test.frame)
## End(Not run)

rpart documentation built on Oct. 10, 2023, 1:08 a.m.