[R] Rotated Labels for grouped bars

Uwe Ligges ligges at statistik.tu-dortmund.de
Sat Jan 21 17:09:04 CET 2012



On 21.01.2012 14:07, Jim_Comiskey at nps.gov wrote:
>
> I want to create a barplot but need to rotate the labels:
>
>
>
> a<- c(1,2,3,4) ; b<- c(2,3,4,5);  c<- c("Loblolly Pine", "Oak Hickory",
> "Sweetgum", "Tulip Poplar")
>
> d = rbind (a,b)
>
> bar<- barplot(d , beside=TRUE)
>
> text(bar, par("usr")[3]-.0025,srt=45,adj=1,labels=c,xpd=TRUE)

Change to
text(colMeans(bar), par("usr")[3]-.0025,srt=45,adj=1,labels=c,xpd=TRUE)
Uwe Ligges


>
>
> I cannot figure out how to get the rotated labels to match up with grouped
> bars rather than individual bars - ie one label per group
>
>
>
> Cheers,
>
>
>
> Jim
>
> ______________________________________________
> 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