Skip to content
Prev 349789 / 398513 Next

Unable to Scale/Display properly in plotting a xts/timeseries graph in a single plot

Did you get any warning messages when you did that?  I get
  > library(xts)
  > z <- xts(cbind(One=sin(1:20), Two=cos(1:20)+1.5), order.by
=as.Date("2015-04-06")+(0:19))
  > plot(z)
  Warning message:
  In plot.xts(z) : only the univariate series will be plotted
and the y limits on the plot are at about c(-1,1).  Thus the
added points in z[,2] will not all be within the limits.

You need to supply ylim=range(z) in the plot call if you want
the limits to include the range of the second column of z.
  > plot(z[,1], ylim=range(z))
  > lines(z[,2], col="red")


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Tue, Apr 7, 2015 at 9:47 AM, Joshua Ulrich <josh.m.ulrich at gmail.com>
wrote: