Duncan Murdoch <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]:
> On 25/11/2007 1:00 PM, John Kane wrote: >> That code seems to put the legend basically out of >> range. >> >> For the last line try x= 8 rather than 10. >> >> legend(x=8,y=.3,paste("Scale=",c(1,2,4,8)),lty=1:4) > > Or use one of the named locations, e.g. > > legend("topright",paste("Scale=",c(1,2,4,8)),lty=1:4) > > Duncan Murdoch My apologies. The original had this line immediately preceding the code I pasted. x <- seq(0,30,length=100) I had an "x" lying around my workspace that did not let me see the errant default behavior. -- David Winsemius >> >> --- David Winsemius <[EMAIL PROTECTED]> wrote: >> >>> "G Ilhamto" <[EMAIL PROTECTED]> wrote in >>> >> news:[EMAIL PROTECTED]: >>> >>>> I want to combine several plots in one graph. >>>> I did this: plot(a1); plot(a2, add=TRUE); >>> ...plot(a5, add=TRUE) >>>> The problem is the more plot we put, the more >>> complex the graph. >>>> Is there any way to label each line; or other way >>> just to make sure I >>>> know which one which? >>>> >>> Try: >>> ?legend >>> >>> This is a worked example taken from Seefeld and >>> Kim's monograph: >>> >> <http://cran.r-project.org/doc/contrib/Seefeld_StatsRBio.pdf> >>> plot(x,dgamma(x,shape=2,scale=1), type='l',xlab="x", >>> ylab="f(x)", main="Gamma pdf's") >>> lines(x,dgamma(x,shape=2,scale=2),lty=2) >>> lines(x,dgamma(x,shape=2,scale=4),lty=3) >>> lines(x,dgamma(x,shape=2,scale=8),lty=4) >>> legend(x=10,y=.3,paste("Scale=",c(1,2,4,8)),lty=1:4) >>> >>> -- >>> David Winsemius >>> >>> ______________________________________________ >>> 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. >>> >> >> ______________________________________________ >> 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. > > ______________________________________________ > 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. > ______________________________________________ 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.