2012-10-20 10 views
5

Znalazłem kilka odpowiedzi na ten temat w Internecie, ale z jakiegoś powodu interpretuję nieprawidłowo, ponieważ nie mogę go uruchomić. Moim celem jest po prostu użyć funkcji xts kreślenia (przy okazji tworzy osi, linie siatki, itp.), Aby wykreślić wiele działek:wykreślając wiele obiektów Xts w jednym oknie

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 

Kolejna próba:

> 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 

Aby być jasne : Mogę to zrobić za pomocą lines, ale zastanawiam się, czy istnieje sposób na zrobienie tego wszystkiego naraz.

Odpowiedz

9

Można zmusić do zoo używać plot.zoo:

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

Albo, można zainstalować xtsExtra który ma nowszą plot.xts metodę

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

W najnowszej wersji 'xtsExtra' ostrzega, że' xtsExtra :: plot.xts' jest przestarzałe i używa 'xts :: plot .xts', ale 'xts :: plot.xts' nadal nie jest w stanie obsłużyć wielu szeregów czasowych, a' xtsExtra :: plot.xts' w rzeczywistości nie tworzy wykresu. – tchakravarty

1

mogę się mylić, ale myślę, że jest plot.xts nie jest już częścią xtsExtra i przeniósł się do głównego xts. Source. Może ta notatka pomoże ludziom w przyszłości próbować rozgryźć w Xts ..

Powiązane problemy