Skip to content

problem with plot.xts

2 messages · Eric Thungstom, Joshua Ulrich

#
Hi Eric,

On Thu, Nov 10, 2011 at 9:38 PM, Eric Thungstom
<eric.thungstrom at gmail.com> wrote:
Thank you for providing a reproducible example.  Next time though, a
_minimal_ example would be better:
library(xts)
data(sample_matrix)
plot(as.xts(sample_matrix[,1]), col="blue")
traceback() tells you the calls that lead up to the error.  You need
to look at the source code to understand what's going on.
This changed in xts about 6 months ago.  The error is caused by '...'
being passed to the axis() commands (that already specify a "col"
argument) inside of plot.xts().
Here are a couple work-arounds you can use:
# specify col in a separate call to lines()
plot(as.xts(sample_matrix[,1])); lines(as.xts(sample_matrix[,1]),col="blue")
# or don't draw the minor tick marks
plot(as.xts(sample_matrix[,1]), minor.ticks=FALSE, col="blue")

Best,
--
Joshua Ulrich  |  FOSS Trading: www.fosstrading.com