[R] something missing from the graph of recursive partitioning
Paul Murrell
p.murrell at auckland.ac.nz
Sat Feb 9 21:01:18 CET 2002
Hi
> The following codes come from R example. I save its
> graph as rpart.ps, but the graph did not display the
> whole word, e.g. just display "bsent", not "absent" in
> the most left. can you advise me how to solve it?
The text is being clipped to the plot boundaries. The following minor
adjustment to your code shows where the clipping is occurring [indicated by
a dashed box around the plot boundary] and a possible fix [via par(xpd)]:
library(rpart)
data(kyphosis)
fit <- rpart(Kyphosis ~ Age + Number + Start, data =
kyphosis)
fit2 <- rpart(Kyphosis ~ Age + Number + Start, data =
kyphosis,
parms = list(prior = c(0.65, 0.35), split =
"information"))
postscript("rpart.ps", width=960, height=960)
par(mfrow = c(1, 2))
par(xpd=NA) # or par(xpd=T)
plot(fit)
text(fit, use.n = TRUE)
box("plot", lty="dashed")
plot(fit2)
text(fit2, use.n = TRUE)
box("plot", lty="dashed")
dev.off()
Paul
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list