I have the following code, which plots 8 means with equal spacing between the bars. I need to get the bars to group together in pairs. I read a lot of answers to similar questions, but I am having trouble figuring out how my code is different-- why isn't it grouping the bars together in pairs??
x = as.numeric(c(filt_forr[1,1:4],filt_forr[1,5:8]))
opar <- par(lwd = 0.3)
plot = barplot(x,axes=FALSE, axisnames=FALSE,ylim=c(0,6),main="Radial Sway of Low and High Frequencies",xlab="Condition",beside=T,ylab="Radial Sway (mm)", cex.names=0.8, las=2, width = 2, col=c("#79c36a","deepskyblue2"),legend = c("Low Frequencies (<0.3 Hz)","Blue = High Frequencies (>0.3 Hz)"))
axis(1,labels=c("Closed/Silence","Closed/Silence","Closed/Noise", "Closed/Noise", "Open/Silence", "Open/Silence","Open/Noise","Open/Noise"),at=plot)
axis(2,at=seq(0,6, by=0.5))
sd = as.numeric(c(filt_forr[2,1:4],filt_forr[2,5:8]))
segments(plot,x-sd,plot,x+sd,lwd=2)
segments(plot-0.1,x-sd,plot+0.1,x-sd,lwd=2)
segments(plot-0.1,x+sd,plot+0.1,x+sd,lwd=2)
abline(c(0,0))
abline(v=0)
Here is a sample of what my data look like (row one has condition means and row 2 has standard deviations, which I use for the error bars):
Cond1Low Cond2Low Cond3Low Cond4Low Cond1High Cond2High Cond3High Cond4High
3.503900 2.714572 2.688209 2.739038 2.499589 2.159015 2.1308462 1.9066430
2.073565 1.680001 1.490732 1.259822 1.139851 0.732513 0.8940674 0.6708717