John Kane Kingston ON Canada
> -----Original Message----- > From: bioinfo.himan...@gmail.com > Sent: Wed, 8 Aug 2012 02:12:00 -0700 (PDT) > To: r-help@r-project.org > Subject: Re: [R] Overlapping a Plot with Dataframe > > Hello John, > > in simple term, I have a Plot as an Output. > Now I want to overlap the plot with a Dataframe having error bar. That's not what the data suggests. > data<- data.frame( > x = c(3.00,2.00,3.80,2.40,2.00), > error = c(0.0,0.4,1.1,0.7,0.5) ) > -- seems to imply that you are plotting a vector of a data frame and if Jim is correct you then want to plot error bars on the plot, using the error vector in 'data'. It is just a wording problem but I don't think that you really mean to overlap the plot with another dataframe because you are only showing one data.frame. In any case, assuming Jim's correct his solution works nicely. Another approach is using ggplot--note I have added an x-axis to the data.frame. library(ggplot2) dat<- data.frame( y = c(3.00,2.00,3.80,2.40,2.00), x = 1:5, error = c(0.0,0.4,1.1,0.7,0.5)) limits <- aes(ymax = y + error, ymin=y - error) p <- p <- ggplot(dat , aes( x, y )) + geom_point() + geom_errorbar(limits) p ____________________________________________________________ FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop! ______________________________________________ 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.