Hello,
The function 'arrows' with angle=90 can do the job.
mydata <-
data.frame(mean=c(0.42,0.41,0.41,0.43,0.45,0.43,0.43,0.42,0.44,0.45,0.45,0.45,0.46,0.43,0.42,0.37,0.44,0.46,0.46,0.39,0.40),
sdUP=c(0.58,0.56,0.55,0.57,0.61,0.55,0.57,0.59,0.61,0.60,0.57,0.60,0.62,0.57,0.59,0.56,0.57,0.61,0.61,0.56,0.54),
sdDOWN=c(0.26,0.26,0.28,0.29,0.30,0.30,0.29,0.26,0.28,0.31,0.34,0.30,0.31,0.30,0.25,0.19,0.31,0.31,0.31,0.22,0.25))
x <- 1:nrow(mydata)
with(mydata, plot(1, type="n", xlim=c(1, nrow(mydata)),
ylim=c(min(sdDOWN), max(sdUP))))
with(mydata, points(x, mean))
with(mydata, arrows(x, mean, x, sdUP, angle=90, length=0.1))
with(mydata, arrows(x, mean, x, sdDOWN, angle=90, length=0.1))
Hope this helps,
Rui Barradas
Em 28-05-2012 18:24, gianni lavaredo escreveu:
The function i am looking is a bars from the mean points of the plot in
boxplot style. I tryed several forum but I have no clear the way to create
these bars.
Gianni
On Mon, May 28, 2012 at 7:13 PM, David Winsemius<dwinsem...@comcast.net>wrote:
On May 28, 2012, at 9:55 AM, gianni lavaredo wrote:
Dear Researchers,
sorry for this simple question. I have a point plot with mean values and
i
wish to plot line with Standard Deviation as "Whiskers". I calculate the
mean+sd and mean-sd, but i can not figure out the way to add the line.
mydata<-
data.frame(mean=c(0.42,0.41,0.**41,0.43,0.45,0.43,0.43,0.42,0.**
44,0.45,0.45,0.45,0.46,0.43,0.**42,0.37,0.44,0.46,0.46,0.39,0.**40),
sdUP=c(0.58,0.56,0.55,0.57,0.**61,0.55,0.57,0.59,0.61,0.60,0.**
57,0.60,0.62,0.57,0.59,0.56,0.**57,0.61,0.61,0.56,0.54),
sdDOWN=c(0.26,0.26,0.28,0.29,**0.30,0.30,0.29,0.26,0.28,0.31,**
0.34,0.30,0.31,0.30,0.25,0.19,**0.31,0.31,0.31,0.22,0.25))
plot(mydata$mean,
type="o",
ylab="mean",
xlab="class")
thanks in advance and sorry for any disturb
If you tried lines() usin either sdUP or sdDOWN you saw nothing because
the ylim was set by default using ony hte information in the mean vector.
Try:
plot(mydata$mean,
+ type="o",
+ ylab="mean",
+ xlab="class", ylim=range(c(mydata$sdUP, mydata$sdDOWN)))
lines(mydata$sdDOWN, col="blue", lty=3)
lines(mydata$sdUP, col="blue", lty=3)
--
David.
[[alternative HTML version deleted]]
______________________________________________
R-help@r-project.org 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@r-project.org 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.