[R] ctree (party) changing font sizes in plots
Achim Zeileis
Achim.Zeileis at wu-wien.ac.at
Fri Nov 20 18:39:23 CET 2009
On Fri, 20 Nov 2009, Sam Thomas wrote:
> When plotting Binary Trees (ctree) from the party package, is there a
> way to adjust the font sizes of the leaves?
Currently, this is not implemented in "party". In interactive usage it is
not easy to change the fontsize. If you're printing to PDF, you could
easily increase/decrease the height and width which will decrease/increase
the relative size of the text, respectively. Not elegant but works.
Alternatively, you could obtain the "partykit" package from R-Forge which
has a new implementation of general infrastructure for tree. With that you
can do
library("partykit")
irisct <- ctree(Species ~ ., data = iris)
plot(irisct, gp = gpar(fontsize = 20))
Note that "party" and "partykit" should not be used together, partykit has
a slightly enhanced/modified ctree() function.
hth,
Z
>
>
> require(party)
>
> irisct <- ctree(Species ~ ., data = iris)
>
> plot(irisct)
>
>
>
> I want to adjust the font sizes for "Node 2", "Node 5", etc. I'd also
> like to be able to adjust the font sizes for the x-axis and y-axis
> labels of the histograms.
>
>
>
> Thanks,
>
>
>
> Sam Thomas
>
> Revelant Technologies, LLC.
>
> sam.thomas at revelanttech.com <mailto:sam.thomas at revelanttech.com>
>
> 317-696-9214
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
More information about the R-help
mailing list