[R] Fitting long names in boxplot

hadley wickham h.wickham at gmail.com
Sat Mar 1 15:45:03 CET 2008


On Fri, Feb 29, 2008 at 4:40 PM, Alex Reynolds <areynolds at stamlab.org> wrote:
> I have the following code:
>
>  subsetTimeDataPlot <- boxplot(subsetTimeData$time ~
>  subsetTimeData$build, horizontal=True, col="lightblue", ...)
>
>  The 'names' component consists of strings that can be up to 20-30
>  characters long.
>
>  How would I go about drawing the names vertically (not the boxplot) or
>  shrinking the names text (I tried cex.names=0.7 but this didn't help).

You might try:

library(ggplot2)
qplot(build, time, data=subsetTimeData, geom="boxplot") + coord_flip()

which will automatically allocate enough space for the names.  You can
find out more about ggplot2 at http://had.co.nz/ggplot2.

Hadley


-- 
http://had.co.nz/



More information about the R-help mailing list