[R] rpart postscript graphics, Mac OS

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Nov 18 09:01:54 CET 2003



On Tue, 18 Nov 2003, Paul Murrell wrote:

> Hi
> 
> 
> Kaiser Fung wrote:
> > I am running R on Mac OS X 10.2x.  When I create
> > postscript graphics of rpart tree objects, a tiny part
> > of the tree gets trimmed off, even when it has only a
> > few terminal nodes.  This happens even without fancy
> > but worse if fancy=T.  (This doesn't happen with
> > boxplot, scatter plots, etc.)  How do I fix this?
> > 
> > postscript("tree.eps")
> > plot(davb.tree, u=T)
> > text(davb.tree, use.n=T, fancy=F)
> > dev.off()
> 
> 
> It's hard to see your problem without the actual data to reproduce it. 
> Does it help if you precede the plot command with par(xpd=NA)?


Well, the "problem" is known (calculating the required space for labeling 
etc. is hard), hence the argument "margin" in plot.rpart().
?plot.rpart tells you:

"margin: an extra percentage of white space to leave around the borders of
the tree. (Long labels sometimes get cut off by the default computation)."  

margin=0.1 is sufficient in most cases.

Uwe Ligges




More information about the R-help mailing list