Re: [R] barplots - text direction

From: Patrick Connolly <p.connolly_at_hortresearch.co.nz>
Date: Thu 25 Aug 2005 - 11:36:56 EST

On Wed, 24-Aug-2005 at 01:54PM +1200, David Scott wrote:

|> On Wed, 24 Aug 2005, Murray Pung wrote:
|>
|> > If the variable names are too long to allow room for each to be displayed on a barplot, how can the direction of the text be changed?
|> >
|> > a <- cbind(2.4,2.4,2.5,2.6,2.6,2.6,2.6,2.6,2.9,2.9,2.9)
|> > b <- cbind(2.3,2.5,2.4,2.2,3.2,2.4,2.9,2.6,2.9,3.0,2.8)
|> > h <- rbind(a,b)
|> > colnames(h) <- c("one","two","three","four","five","six","seven","eight","nine","ten","eleven")
|> > rownames(h) <- c("Pre-stage","Post-stage")
|> > barplot(h, beside = T, legend = colnames(g), horiz = T, xlim = c(0, 5))
|> >
|> >
|>
|> barplot(h, beside = T, legend = colnames(h), horiz = T, xlim = c(0, 5),
|> las=1)
|>
|> will do it.
|>
|> Note: colnames(h) not colnames(g)

And note that rownames(h) will give a more sensible legend.

-- 
Patrick Connolly
HortResearch
Mt Albert
Auckland
New Zealand 
Ph: +64-9 815 4200 x 7188
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
I have the world`s largest collection of seashells. I keep it on all
the beaches of the world ... Perhaps you`ve seen it.  ---Steven Wright 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~

______________________________________________
R-help@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
Received on Thu Aug 25 11:42:48 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:50:30 EST