# [R] Scatter plot with error bars

Blaser Nello nblaser at ispm.unibe.ch
Fri Jun 28 08:41:52 CEST 2013

```Are you sure, you want to calculate 68% confidence intervals?

Best,
Nello

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of beginner
Sent: Freitag, 28. Juni 2013 02:24
To: r-help at r-project.org
Subject: [R] Scatter plot with error bars

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.htm
l
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help