xts icon indicating copy to clipboard operation
xts copied to clipboard

recycling type

Open timelyportfolio opened this issue 9 years ago • 1 comments

I post this more as a conversation, since this can be easily overcome by adding series than with just one plot call. This might be best handled by an adding an example or some discussion in the documentation. As I was testing out #87, I discovered that recycling type will not work.

library(xts)
data(sample_matrix)
x <- as.xts(sample_matrix)
y <- merge(x,x+1,x+2,x+3)
plot(y,type=c("l","p"))

results in an error with the switch conditional

Error in switch(type, h = { : EXPR must be a length 1 vector
In addition: Warning message:
In if (type == "h" & NCOL(x) > 1) warning("only the univariate series will be plotted") :
  the condition has length > 1 and only the first element will be used

timelyportfolio avatar May 07 '15 14:05 timelyportfolio

This may be an interesting feature to add to a later release so we have some more time to think about and test. It should just work with a basic plot and multiple panels, but I'm not entirely sure. As you point out, you can easily plot several types with calls to lines/points/addSeries and base plot doesn't support a vector for type so I don't think we need to target adding this feature for the upcoming release.

Thanks again for all the testing, your feedback has been very helpful.

rossb34 avatar May 10 '15 12:05 rossb34