Re: [R] rotate bar labels in barplot()

From: Peter Alspach <PAlspach_at_hortresearch.co.nz>
Date: Thu, 03 Apr 2008 14:27:05 +1300

Ricardo

I suggest you modify the mar argument of par. For example,

barplot(1:10, names=rep(paste(letters[1:26], collapse=' '), 10), las=2)

the labels won't fit with the default settings, so try:

par(mar=c(20,4,4,2))
barplot(1:10, names=rep(paste(letters[1:26], collapse=' '), 10), las=2)

There's a lot in ?par - it is worth studying closely ....

Peter Alspach

> -----Original Message-----
> From: [Ricardo Rodriguez] Your XEN ICT Team
> [mailto:webmaster_at_xen.net]
> Sent: Thursday, 3 April 2008 2:08 p.m.
> To: Peter Alspach; r-help_at_r-project.org
> Subject: Re: [R] rotate bar labels in barplot()
>
> Thanks Peter,
>
> Peter Alspach wrote:
> > Ricardo
> >
> > The las argument will allow rotation of 90 degrees:
> >
> > par(mfrow=c(2,2))
> > barplot(1:10, names=letters[1:10], las=0) barplot(1:10,
> > names=letters[1:10], las=1) barplot(1:10,
> names=letters[1:10], las=2)
> > barplot(1:10, names=letters[1:10], las=3)
> >
> > If you want to do other rotation angles then it will be
> more complicated (but not much).
> >
>
> 90ª will be OK. But I am afraid I will have to move to axis() anyway.
> Look at this...
>
> http://mire.environmentalchange.net/~webmaster/images/BarPlotLabel.png
>
> It seems there is not enough room for labels. Even those that
> are short enough aren't always displayed. If I use letters,
> they do just fine.
> Could I control this space? I am afraid that I don't
> understand this ...
> at the bottom of the arguments list in ?barplot or any other
> R function :-(
>
> Thank you so much for your help,
>
> Ricardo
>
> --
> Ricardo Rodríguez
> Your XEN ICT Team
>
>

The contents of this e-mail are privileged and/or confidential to the named  recipient and are not to be used by any other person and/or organisation.  If you have received this e-mail in error, please notify the sender and delete  all material pertaining to this e-mail.



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. Received on Thu 03 Apr 2008 - 01:29:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 Apr 2008 - 01:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive