Skip to content

Problem with plot.xts

3 messages · Pierre Lapointe, Jeff Ryan, Gabor Grothendieck

#
Hello,

I want to draw a plot.xts without any axis or labels (I need to
overlay 2 plots with par (new=TRUE). )

Unfortunately, the axes = FALSE argument is overridden in the function.

Here's my code. I only want the data line. No axes or labels.

library(xts)
data(sample_matrix)
sample.xts <- as.xts(sample_matrix)
plot(sample.xts[,1],type="l",axes=FALSE,xlab="",ylab="",auto.grid=FALSE)

I'm on Vista. R 2.10.0

BTW, what is the "ann" argument in the function supposed to do?

Thanks.
#
Pierre,

xts wasn't meant to include much in the way of graphics. quantmod was
designed for that.

For more complete standard graphical capabilities simply convert to zoo.

plot(as.zoo(x))

If there is a need at some point that can't be sufficiently addressed
with zoo or quantmod, it may be a good case for extending xts in that
direction, but for now the above alternatives are better.

Best,
Jeff
On Tue, Dec 22, 2009 at 6:09 PM, Pierre Lapointe <pierrelap at gmail.com> wrote:

  
    
#
Note that if you wish to use as.zoo then this will get rid of the axis markings:


library(xts)
data(sample_matrix)
sample.xts <- as.xts(sample_matrix)
plot(as.zoo(sample.xts[,1]), xaxt = "n", yaxt = "n", xlab = "", ylab = "")

Also note that zoo has both plot.zoo and xyplot.zoo where the latter
implements time series plotting in lattice.  The help files and the
three vignettes.
On Tue, Dec 22, 2009 at 10:11 PM, Jeff Ryan <jeff.a.ryan at gmail.com> wrote: