Or look at the xlim and ylim arguments to plot. E.g., > x1 <- 1:10 ; x2 <- 11:17 ; x3 <- 21:23 > plot(NA, NA, xlim=range(1, length(x1), length(x2), length(x3)), > ylim=range(x1, x2, x3), type="n", xlab="", ylab="") > points(x1, type="b") > lines(x2) > points(x3) > title(xlab="The X Values", ylab="The Y Values")
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Jorge I Velez > Sent: Monday, March 19, 2012 12:03 PM > To: Alaios > Cc: R help > Subject: Re: [R] Automaticall adjust axis scales > > Perhaps matplot()? > > matplot(cbind(x1, x2, x3), type = 'l') > > See ?matplot for more information. > > HTH, > Jorge.- > > > On Mon, Mar 19, 2012 at 2:40 PM, Alaios <> wrote: > > > Dear all, > > > > I have made a function that given a number of list elements plot them to > > the same window. > > > > The first element is plotted by using plot and all the rest are plotted > > under the > > > > same window by using lines. > > > > I have below a small and simple reproducible example. > > > > > > x1<-c(1:10) > > plot(x1) > > > > x2<-c(11:20) > > lines(x2) > > > > x3<-c(31:40) > > lines(x3) > > > > > > > > > > as you might notice > > the two consecutive lines fail to be plotted as the axis were formed by > > the first plot. > > Would it be possible after the last lines to change the axis to the > > minimum and the maximum of all data sets to be visible? > > > > Any idea how I can do that? > > > > I would like to thank you for your help > > > > B.R > > Alex > > > > [[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]] > > ______________________________________________ > 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.