Hi, Could anyone give suggestions how to plot a scatter plot with 1 standard deviation for each point. To make it clearer, here is a simple example: the scatterplot is plot(X, Y), but I want to add 1 standard deviation according to the value of Z for each Y. X Y Z 1 3.5 1.1 . . . . . . . . . Thanks a lot in advance. FD [[alternative HTML version deleted]]
FD wrote:> Hi, > > Could anyone give suggestions how to plot a scatter plot with 1 standard > deviation for each point. To make it clearer, here is a simple example: the > scatterplot is plot(X, Y), but I want to add 1 standard deviation according > to the value of Z for each Y. > > X Y Z > 1 3.5 1.1 > . . . > . . . > . . . >Hi FD, There are lots of ways to do this (if I understand what you want). library(plotrix) # first way plot(1,3.5) dispbars(1,3.5,1.1) # second way plotCI(1,3.5,1.1) Another version of plotCI lives in the gplots package. errbar is in the Hmisc and sfsmisc packages. plotMeans in the Rcmdr package. and probably quite a few more. Jim
hadley wickham
2007-Oct-21 16:51 UTC
[R] scatter plot with 1 standard deviation for each point
> Could anyone give suggestions how to plot a scatter plot with 1 standard > deviation for each point. To make it clearer, here is a simple example: the > scatterplot is plot(X, Y), but I want to add 1 standard deviation according > to the value of Z for each Y.You can do this with ggplot2 with the following command: qplot(X, Y, data = df, geom="pointrange", min = Y - Z, max = Y + Z) You can see a few variations at http://had.co.nz/ggplot2/geom_linerange.html Hadley -- http://had.co.nz/