Hi: Try this instead of your original lines() statement:
lines(x + 0.1, att, type="h", col="red") or plot(numgoal, goal, type="h", lwd = 3) x <- 0:5 y<-dpois(x, lambda) att<-y*380 lines(x + 0.1, att, type="h", col="red", lwd = 3) legend(x="topright", legend=c("Osservate", "Attese"), col=c("black","red"), ncol=1, lty=1, lwd=3, inset=c(0.01, 0.02), bg="white") or plot(numgoal - 0.05, goal, type="h", lwd = 3) x <- 0:5 y<-dpois(x, lambda) att<-y*380 lines(x + 0.05, att, type="h", col="red", lwd = 3) legend(x="topright", legend=c("Osservate", "Attese"), col=c("black","red"), ncol=1, lty=1, lwd=3, inset=c(0.01, 0.02), bg="white") Dennis On Tue, Mar 22, 2011 at 9:12 AM, danielepippo <dan...@hotmail.it> wrote: > Hi R-users, > > I'm trying to built a plot of two series of data, but thees series > result "superimposed". The R-code is like this: > > goal <- c(125, 143, 81, 26, 2, 3) > numgoal <- 0:5 > lambda <- sum(goal*numgoal)/sum(goal) > plot(numgoal, goal, type="h") > x <- 0:5 > y<-dpois(x, lambda) > att<-y*380 > lines(x,att, type="h", col="red") > legend(x="topright", legend=c("Osservate", "Attese"), col=c("black","red"), > ncol=1, lty=1, lwd=3, > inset=c(0.01, 0.02), bg="white") > > > How can I draw the two lines one near other? > > Thanks a lot to everyone > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Problem-with-plot-histogram-tp3396873p3396873.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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]] ______________________________________________ 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.