5

これに対するいくつかの回答をオンラインで見つけましたが、何らかの理由で正しく解釈できないため、正しく解釈できません。私の目標は、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を一度に行う方法があるかどうか疑問に思います。

4

2 に答える 2

9

あなたは使用するように強制することができzooますplot.zoo

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

または、新しいメソッドを持つxtsExtraをインストールすることもできますplot.xts

#install.packages("xtsExtra", repos='http://r-forge.r-project.org')
library(xtsExtra)
plot(x, screens=1)
于 2012-10-20T22:49:54.763 に答える
2

私は間違っているかもしれませんが、plot.xts はもはや xtsExtra の一部ではなく、メインの xts に移動したと思います。ソース。おそらく、このメモは、将来、xts でのプロットを理解しようとする人々に役立つでしょう..

于 2016-04-23T03:52:21.900 に答える