Chris Conner
2012-Jan-06 23:09 UTC
[R] Please help!! How do I set graphical parameters for ploting ctree()
I'm trying to understand how to set graphical parameters for trees created with the party package. For example take the following code: library(party) data(airquality) airq <- subset(airquality, !is.na(Ozone)) airct <- ctree(Ozone ~ ., data = airq, controls = ctree_control(maxsurrogate = 3)) plot(airct) My problem is, I've got a ctree that has 14 terminal nodes, and as a result of the default graphical paramters of plot(ctree), all of the text is completely undreadable (decison node text is too large and as a result, these nodes overlap one another, terminal node barplot text overlaps hideously). What I would like to do is learn how to customize the elements of these plots. For the text, I have tried par(cex=.4, cex.main=.4, cex.axis=.2, cex.lab=.2)... to no avail. As far as reducing the size of the node ovals, I'm completely lost there... Anyone have any suggestions? Thanks in advance! Chris [[alternative HTML version deleted]]
David Winsemius
2012-Jan-07 02:30 UTC
[R] Please help!! How do I set graphical parameters for ploting ctree()
On Jan 6, 2012, at 6:09 PM, Chris Conner wrote:> I'm trying to understand how to set graphical parameters for trees > created with the party package. For example take the following code: > > library(party) > data(airquality) > airq <- subset(airquality, !is.na(Ozone)) > airct <- ctree(Ozone ~ ., data = airq, > controls = ctree_control(maxsurrogate = 3)) > plot(airct) > > My problem is, I've got a ctree that has 14 terminal nodes, and as a > result of the default graphical paramters of plot(ctree), all of the > text is completely undreadable (decison node text is too large and > as a result, these nodes overlap one another, terminal node barplot > text overlaps hideously). What I would like to do is learn how to > customize the elements of these plots. For the text, I have tried > par(cex=.4, cex.main=.4, cex.axis=.2, cex.lab=.2)... to no avail. > As far as reducing the size of the node ovals, I'm completely lost > there...After looking at: party:::plot.BinaryTree and party:::node_inner ... I've decided that you cannot. Neither of those function appear to accept parameters for shrinking the text. You could of course modify the code but if you couldn't find this answer on your own, then I have doubts that you possess the skills. So what are you to do? My suggestion would be to make a bigger plot on a vector graphics device (ps, pdf) and then shrink it. -- David Winsemius, MD West Hartford, CT