2012-10-20 5 views
5

온라인으로 답변을 찾았지만 어떤 이유로 작동하지 않아서 해석이 잘못되었습니다. 내 목표는 단순히 여러 플롯을 플롯 (. 그것은 생성하는 방법 축, 눈금 선 등 사용) xts 플로팅 기능을 사용하는 것입니다복수 창 xts 객체를 하나의 창에 그려야합니다.

x <- xts(data.frame(a=1:100, b=100:1),seq(from=as.Date("2010-01-01"), by="days", len=100)) 
> plot(x, screens=1) 
Warning messages: 
1: In plot.xts(x, screens = 1) : 
    only the univariate series will be plotted 
2: In plot.window(...) : "screens" is not a graphical parameter 
3: In plot.xy(xy, type, ...) : "screens" is not a graphical parameter 
4: In axis(1, at = xycoords$x, labels = FALSE, col = "#BBBBBB", ...) : 
    "screens" is not a graphical parameter 
5: In axis(1, at = xycoords$x[ep], labels = names(ep), las = 1, lwd = 1, : 
    "screens" is not a graphical parameter 
6: In axis(2, ...) : "screens" is not a graphical parameter 
7: In title(screens = 1) : "screens" is not a graphical parameter 

또 다른 시도 :

> plot(x, plot.type="single") 
Warning messages: 
1: In plot.xts(x, plot.type = "single") : 
    only the univariate series will be plotted 
2: In plot.window(...) : "plot.type" is not a graphical parameter 
3: In plot.xy(xy, type, ...) : "plot.type" is not a graphical parameter 
4: In axis(1, at = xycoords$x, labels = FALSE, col = "#BBBBBB", ...) : 
    "plot.type" is not a graphical parameter 
5: In axis(1, at = xycoords$x[ep], labels = names(ep), las = 1, lwd = 1, : 
    "plot.type" is not a graphical parameter 
6: In axis(2, ...) : "plot.type" is not a graphical parameter 
7: In title(plot.type = "single") : 
    "plot.type" is not a graphical parameter 

것은 분명하기 : lines을 사용하여이 작업을 수행 할 수 있지만 한 번에이 작업을 수행 할 수있는 방법이 있는지 궁금합니다.

답변

9

당신은 plot.zoo 사용 zoo에 강요 수 :

plot(as.zoo(x), screens=1) 
plot(as.zoo(x), plot.type='single') 

을 또는, 당신은 새로운 plot.xts 방법

#install.packages("xtsExtra", repos='http://r-forge.r-project.org') 
library(xtsExtra) 
plot(x, screens=1) 
+6

'xtsExtra'의 최신 버전에서는'xtsExtra :: plot.xts'가 더 이상 사용되지 않으며'xts :: plot .xts'이지만,'xts :: plot.xts'는 여전히 여러 개의 시계열을 처리 할 수 ​​없으며'xtsExtra :: plot.xts'는 실제로 플롯을 생성하지 않습니다. – tchakravarty

1

내가 잘못 될 수있다 xtsExtra을 설치할 수 있지만 plot.xts이 생각 더 이상 xtsExtra의 일부가 아니며 주 xts로 이동했습니다. Source. 어쩌면이 메모는 미래의 사람들이 xts에서 음모를 꾸미는 데 도움이 될 것입니다.