[R] how to use 'points' function to plot two curves with errbar

John Kane jrkrideau at yahoo.ca
Sat Jun 5 20:06:27 CEST 2010


The first thing we need to know is what "errbar" are you using?

There are at least two, on in the Hmisc package and one in sfsmisc.

 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained,reproducible code.

I'm not sure what you are trying to do here but perhaps looking  at "new" in ?par  might hrlp you.

Example:
plot(1:10, col="red")
par(new=TRUE)
plot(10:1, col="blue")


 

--- On Sat, 6/5/10, Yogesh Tiwari <yogesh.mpi at googlemail.com> wrote:

> From: Yogesh Tiwari <yogesh.mpi at googlemail.com>
> Subject: [R] how to use 'points' function to plot two curves with errbar
> To: r-help at stat.math.ethz.ch
> Received: Saturday, June 5, 2010, 10:06 AM
> Dear R Users,
> I am using R on windows.
> 
> how to use 'points' function to plot two curves with
> errbar
> 
> I am doing like:
> 
> x.val <- as.integer(names(co2mean))
> errbar(x.val, co2mean, co2mean + co2sd, co2mean - co2sd,
> xaxt='n', col=1,
> xlab=NA,ylab=NA)# obs error bar
> lines(x.val, co2mean, col=1, lwd=2)
> 
> errbar(x.val, co2tm3.month.mean, co2tm3.month.mean +
> co2sd.tm3,
> co2tm3.month.mean - co2sd.tm3, xaxt='n', col=2,
> xlab=NA,ylab=NA)# model
> error bar
> lines(x.val, co2tm3.month.mean, col=2, lwd=2)
> 
> Above code replaces first error bar and its line with
> second. Kindly help,
> how to use 'points' function here so both above can get
> over ploted
> 
> Thanks,
> Regards,
> Yogesh

PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
>



More information about the R-help mailing list