2012-10-20 16 views
5

Bu çevrimiçi cevabı buldum, ancak bir nedenden dolayı yanlış yorumluyorum çünkü işe yaramayacağım. Amacım sadece birden araziler çizmek için (. Yarattığı şekilde eksen, kılavuz çizgileri, vs ile) xts komplo özelliğini kullanmaktır:Bir pencerede birden çok xts nesnesi çizimi

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 

Başka deneyin:

> 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 

Açık olmak gerekirse : lines'u kullanarak bunu yapabilirim ama bir an önce bunu yapmanın bir yolu olup olmadığını merak ediyorum.

cevap

9

Sen plot.zoo kullanmak zoo için zorlamak olabilir:

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

Veya, yeni bir plot.xts yöntemi

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

'xtsExtra '' nin en son sürümünde xtsExtra :: plot.xts 'kullanımdan kaldırılmış ve xts :: arsa kullanımı uyardı .xts', ancak 'xts :: plot.xts' hala çoklu zaman serilerini işleyemiyor ve' xtsExtra :: plot.xts' aslında bir çizim oluşturmuyor. – tchakravarty

1

Ben yanlış olabilir sahiptir xtsExtra yükleyebilir ama plot.xts olduğunu düşünüyorum xtsExtra'nın bir parçası değil ve ana xts'e taşındı. Source. Belki bu not gelecekteki insanlar xts içinde komplo çözmek için yardımcı olacaktır ..

İlgili konular