[R] overlaying

John Kane jrkrideau at yahoo.ca
Mon Mar 28 00:19:23 CEST 2011



--- On Sun, 3/27/11, Bulent Arikan <bulent.arikan at gmail.com> wrote:

> From: Bulent Arikan <bulent.arikan at gmail.com>
> Subject: [R] overlaying
> To: r-help at r-project.org
> Received: Sunday, March 27, 2011, 5:45 PM
> Dear List,
> I am working with a small (3 columns and 9 rows) data
> table, which contains
> 9 observations, their mean values and standard deviations
> (I extracted these
> data from a huge set and I cannot use the original data). I
> plotted means
> (y-axis) and the observations (x-axis) using the " plot() "
> command.
> However, I am not sure how to plot the standard deviation
> data on top of
> this. This kind of chart will save me time and space so I
> want to overlay
> standard deviation values. I appreciate your suggestions in
> terms of how to
> do this or using a different type of graph.
> 
> Thank you,
> 
> -- 
> BÜLENT ARIKAN, PhD
> Postdoctoral Scholar
> Center for Social Dynamics and Complexity &
> School of Human Evolution and Social Change
> Arizona State University
> Tempe - AZ
> 85287-2402
> 
# Usesarrows to produce confidence intervals for a set of values.

low  <- c(312.9460, 312.9419, 312.9422, 312.9380 )
mass <- c(312.9476, 312.9435, 312.9438 , 312.9396 )
high  <- c(312.9492, 312.9451, 312.9454, 312.9412)

yaxis <- seq(1,4,by=1)
plot(x = mass, y = yaxis, pch=17, xlim = c(312.9378,312.9500), axes=FALSE,
     xlab = 'mass', ylab = '', main = 'Mass/Intensity Problem')
labs <- seq(312.8, 312.95, by = 0.0005)
axis(1, at = labs, labels = labs)
axis(2, at = yaxis, las = 2)

arrows(x0 = low, x1 = high, y0 = yaxis, y1 = yaxis,
length=0.1, code = 3, col = 4, angle = 90)
box()


> 





More information about the R-help mailing list