Skip to content
Back to formatted view

Raw Message

Message-ID: <4D4C716E.3030803@ase-research.org>
Date: 2011-02-04T21:36:46Z
From: Mathieu Basille
Subject: problem barplot width
In-Reply-To: <AANLkTimpnfVE_7QQFmh-OnNORo0Vi6Gi4nFXUz4wU=Xi@mail.gmail.com>

The help page of barplot says:

   width: optional vector of bar widths. Re-cycled to length the number
          of bars drawn.  Specifying a single value will have no
          visible effect unless ?xlim? is specified.

Following your code, have a look at these examples, which might help to
understand:

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

Hope this helps,
Mathieu.


Le 2011-02-04 16:24, Mario Beolco a ?crit :
> 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-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology

-- 

~$ whoami
Mathieu Basille, Post-Doc

~$ locate
Laboratoire d'?cologie Comportementale et de Conservation de la Faune
+ Centre d'?tude de la For?t
D?partement de Biologie
Universit? Laval, Qu?bec

~$ info
http://ase-research.org/basille

~$ fortune
``If you can't win by reason, go for volume.''
Calvin, by Bill Watterson.