[R] barplot help needed

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Fri Nov 24 14:38:11 CET 2006


Is the length of all your datasets equal? If not try 
etype <- rep(c(sd1, sd2, sd3, sd4), c(length(data1), length(data2), length(data3), length(data4))

Cheers,

Thierry
----------------------------------------------------------------------------

ir. Thierry Onkelinx

Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature and Forest

Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance

Gaverstraat 4

9500 Geraardsbergen

Belgium

tel. + 32 54/436 185

Thierry.Onkelinx op inbo.be

www.inbo.be 

 

Do not put your faith in what statistics say until you have carefully considered what they do not say.  ~William W. Watt

A statistical analysis, properly conducted, is a delicate dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney


-----Oorspronkelijk bericht-----
Van: r-help-bounces op stat.math.ethz.ch [mailto:r-help-bounces op stat.math.ethz.ch] Namens Antje
Verzonden: vrijdag 24 november 2006 13:42
Aan: r-help op stat.math.ethz.ch
Onderwerp: Re: [R] barplot help needed

Thank you very much for your help.
I just don't understand the following line (which also gives me a 
dimension error later in the arrows command)

etype <- rep(c(sd1, sd2, sd3, sd4), length(data1))

Antje

(I don't see my emails to the mailinglist anymore... just the answers 
from other people... I don't understand???)


Jacques VESLOT schrieb:
> tab <- do.call(rbind, list(data1, data2, data3, data4))
> etype <- rep(c(sd1, sd2, sd3, sd4), length(data1))
> b <- barplot(tab, beside=T)
> arrows(unlist(b), unlist(tab) - etype, unlist(b),  unlist(tab) + etype, 
> code=3)
> -------------------------------------------------------------------
> Jacques VESLOT
> 
> CNRS UMR 8090
> I.B.L (2ème étage)
> 1 rue du Professeur Calmette
> B.P. 245
> 59019 Lille Cedex
> 
> Tel : 33 (0)3.20.87.10.44
> Fax : 33 (0)3.20.87.10.31
> 
> http://www-good.ibl.fr
> -------------------------------------------------------------------
> 
> Antje a écrit :
>> hello,
>>
>> I would like to create the following barplot:
>>
>> I have 4 different data sets (same length + stddev for each data point)
>>
>> data1
>> sd1
>> data2
>> sd2
>> data3
>> sd3
>> data4
>> sd4
>>
>> now, I'd like to plot in the following way:
>>
>> data1[1],data2[1],data3[1],data4[1] with it's sd-values side-by-side 
>> at one x-axis label (named "position 1") and each bar in different 
>> colors.
>>
>> data1[2],data2[2],data3[2],data4[2] at the next x-axis label (named 
>> "position 2") with the same color scheme
>>
>> and so on over the whole length.
>>
>> I managed to plot one set in the following way:
>>
>> par(mai=c(1.5,1,1,0.6))
>> plotInfo <- barplot(data1, las=2, ylim = c(0,plotMax+1), ylab = 
>> "Percentage")
>> arrows(plotInfo,data1,plotInfo,  data1 + sd1, length=0.1, angle=90)
>> arrows(plotInfo,data1,plotInfo,  data1 - sd1, length=0.1, angle=90)
>>
>> could anybody give me a help on this?
>>
>> Antje
>>
>> ______________________________________________
>> R-help op 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
>> and provide commented, minimal, self-contained, reproducible code.
>>
>

______________________________________________
R-help op 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
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list