Hi Roslina,
Try
par(mar=c(4,4,2,1.2),oma=c(0,0,0,0),xaxs="i", yaxs="i")
plot(ecdf(rnorm(100)))
plot(ecdf(rnorm(100)), add = TRUE, col = 2)
HTH,
Jorge
On Thu, Nov 25, 2010 at 12:18 AM, Roslina Zakaria <> wrote:
> Hi r-users,
>
> I would like to overlap 2 ecdf plots.
>
> I tried this below and it gives me two plots of ecdf but just both just in
> black.
>
> par(mar=c(4,4,2,1.2),oma=c(0,0,0,0),xaxs="i", yaxs="i")
> plot(ecdf(datobs))
> lines(ecdf(gam_sum_gen))
>
> Then I try to add colors etc and also the legend but fail.
>
> par(mar=c(4,4,2,1.2),oma=c(0,0,0,0),xaxs="i", yaxs="i")
> plot(ecdf(datobs),main ="CDF of the sum for winter
> season-Hume",cex.axis=1.2,xlab="Rainfall (mm)", pch >
pch,verticals=TRUE,col=c("black","red"),
lty=c(1,1),ylab="Cumulative
> probability", xlim=c(0,800),lwd=1)
> lines(ecdf(gam_sum_gen))
> legend("topright", legend =
c("observed","fitted"),
> col = c("black","red"), pch=c(NA,NA), lty = c(1,
1),
> lwd=c(3,3),bty="n", pt.cex=2)
> box()
>
> I'm not sure why it doesn't show up at all.
>
> Thank you for any help given.
>
>
>
> [[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.
>
>
[[alternative HTML version deleted]]