midnightsun@blueyonder.co.uk
2005-Mar-09 11:21 UTC
[R] Plotting several series on one set of axes
Dear All, I am rather rusty with my R, but I recall being able to do something like plot(x1,...);plot(x2,add=TRUE,...) to plot two series on the same axes. Any suggestions how this may be done will be appreciated.
midnightsun at blueyonder.co.uk wrote:>Dear All, > >I am rather rusty with my R, but I recall being able to do something like >plot(x1,...);plot(x2,add=TRUE,...) >to plot two series on the same axes. > >Any suggestions how this may be done will be appreciated. > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > > > >?lines ?points par(new=TRUE) cheers Eryk -- Witold Eryk Wolski __("< School of Mathematics and Statistics _ \__/ University of Newcastle 'v' || Newcastle upon Tyne, NE1 7RU, ENGLAND / \ ^^ mail: witek96 at users.sourceforge.net m m Phone : 044 (0)191 222 5376 FAX : 044 (0)191 222 8020
On Wed, 2005-03-09 at 11:21 +0000, midnightsun at blueyonder.co.uk wrote:> Dear All, > > I am rather rusty with my R, but I recall being able to do something like > plot(x1,...);plot(x2,add=TRUE,...) > to plot two series on the same axes. > > Any suggestions how this may be done will be appreciated.If you have several series with common axes, you can use matplot() and do it with a single function call. See ?matplot for more information. HTH, Marc Schwartz
<midnightsun <at> blueyonder.co.uk> writes: : I am rather rusty with my R, but I recall being able to do something like : plot(x1,...);plot(x2,add=TRUE,...) : to plot two series on the same axes. : You can use ts.plot to plot multiple ts time series on one set of axes in one command (even if they have different time bases though they must have the same frequency). See ?ts.plot zoo can represent series as irregular so that even ones with different frequencies can be simultaneously plotted on the same axes in one command. See library(zoo)l; help(plot.zoo)