[R] question how to add Standard Deviation as Whiskers in a simple plot

2012-05-28 Thread gianni lavaredo
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

Gianni

[[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.


Re: [R] question how to add Standard Deviation as Whiskers in a simple plot

2012-05-28 Thread David Winsemius


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.

__
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.


Re: [R] question how to add Standard Deviation as Whiskers in a simple plot

2012-05-28 Thread gianni lavaredo
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.netwrote:


 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.


Re: [R] question how to add Standard Deviation as Whiskers in a simple plot

2012-05-28 Thread Walmes Zeviani
This post are useful.

http://myowelt.blogspot.com.br/2008/03/beautiful-error-bars-in-r.html
http://mapas.mma.gov.br/i3geo/pacotes/rlib/win/gplots/html/plotCI.html

Walmes.

==
Walmes Marques Zeviani
LEG (Laboratório de Estatística e Geoinformação, 25.450418 S, 49.231759 W)
Departamento de Estatística - Universidade Federal do Paraná
fone: (+55) 41 3361 3573
VoIP: (3361 3600) 1053 1173
e-mail: wal...@ufpr.br
twitter: @walmeszeviani
homepage: http://www.leg.ufpr.br/~walmes
linux user number: 531218
==

[[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.


Re: [R] question how to add Standard Deviation as Whiskers in a simple plot

2012-05-28 Thread Rui Barradas

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 Winsemiusdwinsem...@comcast.netwrote:


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.