[R] problem barplot width

Ista Zahn izahn at psych.rochester.edu
Sat Feb 5 00:52:00 CET 2011


Hi Mario,
>From the help file for barplot:

"Specifying a single value will have no visible effect unless 'xlim'
is specified."

OK, so:

barplot(d,col=barcol,ylim=c(min(d-s*1.25),max(d+s*1.25)), xlim=c(0,1),
width=.1, space = 2)

Best,
Ista
On Fri, Feb 4, 2011 at 4:15 PM, Mario Beolco <mario.beolco at gmail.com> wrote:
> Dear R-users,
>
> apologies for the total beginner's question, but I have been trying to
> solve this problem for ages and I seem to be getting nowhere. I also
> have tried to search through the archives of the R mailing list, but I
> am still left with my problem. How do I change the width of the bars
> for this simple barplot? I understand that the the "width" argument
> might do what I want and I have tried to use it to change the width of
> the bars e.g. width=c(0.01,0.01,0.01), but it does not do what I want.
> Any help/suggestions would be greatly appreciated.
>
> # some data
> d<-c(-4.227684e-04,2.012307e-04,4.085164e-05)
> s<-c(3.588785e-05,9.133071e-05,2.072433e-05)
>
> # barplot colour
> barcol<-c("#6E8B3D","#FFB90F","#8B0000","#6E8B3D","#FFB90F","#8B0000","#6E8B3D","#FFB90F","#8B0000")
>
> # create barplot
> barplot(d,col=barcol,ylim=c(min(d-s*1.25),max(d+s*1.25)),space=0.1)
>
>
> thanks in advance for your help
>
> Best wishes,
>
> Mario
>
> ______________________________________________
> 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.
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org



More information about the R-help mailing list