[R] Scatter plot with error bars
beginner
paxkn at nottingham.ac.uk
Fri Jun 28 02:24:01 CEST 2013
Hi
I would like to plot multiple data sets on a scatter plot with error bars.
To do this I write the following code:
install.packages("Hmisc")
library(Hmisc)
x1<-data1[,1]
y1<-data1[,2]
x2<-data2[,1]
y2<-data2[,2]
x3<-data3[,1]
y3<-data3[,2]
SD1<-data1[,3]
SD2<-data2[,3]
SD3<-data3[,4]
delta<-runif(5)
errbar(x1,y1,y1+SD1, y1-SD1, col="red",pch=19)
lines(x1,y1,col="red", pch=19, lty=3)
errbar(x2,y2,y2+SD2, y2-SD2, col="green",pch=19)
lines(x2,y2,col="green", pch=19, lty=3)
errbar(x3,y3,y3+SD3, y3-SD3, col="blue",pch=19)
lines(x3,y3,col="blue", pch=19, lty=3)
However, with this code I can obtain only the scatter plot for x1, y1, but
not for the other data sets. Could you please let me know how should I
modify the code presented above ?
In other situations, when I try to make a scatter plot of several data sets
without error bars, I usually use points () function.
However it does not work in the presented case...
I would be very grateful for your help.
--
View this message in context: http://r.789695.n4.nabble.com/Scatter-plot-with-error-bars-tp4670502.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list