[R] Force labelling of x-axis

Renaud Lancelot renaud.lancelot at cirad.fr
Mon Mar 21 06:34:07 CET 2005


Bill Kranec a écrit :

> Hi,
> 
> I'm trying to do a box-whisker plot of two columns of a data frame, a
> list of category names in one column vs. some numerical values in the
> other.  The plot itself works fine, but only a few points of the x-axis
> ( the category names ) are labelled.  I think that this is because the
> category names are too long.
> 
> Is there any way to force R to label each x-axis value, preferably at a
> 45-degree slant so that each one can be seen?  I feel like this should be
> pretty easy to do, but I can't find anything obvious from the R-manual.
> 
> Thanks for any help,
> 
> Bill
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

For example:

test <- data.frame(
           y = rnorm(120),
           x = rep(month.name, each = 100))
library(lattice)
bwplot(y ~ x, data = test, scales = list(x = list(rot = 45)))

Best,

Renaud

-- 
Dr Renaud Lancelot, vétérinaire
C/0 Ambassade de France - SCAC
BP 834 Antananarivo 101 - Madagascar

e-mail: renaud.lancelot at cirad.fr
tel.:   +261 32 40 165 53 (cell)
         +261 20 22 665 36 ext. 225 (work)
         +261 20 22 494 37 (home)




More information about the R-help mailing list