[R] Combining tplot and barplot

mmichel mmichel at mpi-cbg.de
Thu Dec 11 16:54:02 CET 2008


Hello!

I am pretty new to R statistics and trying to figure out how to show  
the barplot and the single data points in one single plot.
I am using the tplot code from the following site for showing the  
single datapoints:
http://biostat.mc.vanderbilt.edu/twiki/pub/Main/TatsukiRcode/ 
TatsukiRcodeTplot.r

I have two sets of data (x,y) that I want to compare, by plotting a  
Barplot and the single data points. Unfortunately they are shifted,  
so that the data points are not right on top of the bars.

The code I used for plotting the data:

x<-c(835,728,2281,1049,1574,1340,621)
y<-c(466,922,2647,914,1342,998,655)
aver<-c(mean(x),mean(y))
barplot(aver,col=0,ylim=range(0,2750))
tplot(x,y,add=TRUE,axes=FALSE)

I would be grateful, if someone could tell me, what the problem (and  
hopefully the solution) might be!

Thank you very much!



More information about the R-help mailing list