开发者

Adding points to xts plot

开发者 https://www.devze.com 2023-04-02 04:43 出处:网络
I开发者_如何学运维 thought Adding Points, Legends and Text to plots using xts objects would have the answer to this question, but apparently not...

I开发者_如何学运维 thought Adding Points, Legends and Text to plots using xts objects would have the answer to this question, but apparently not...

require(quantmod)
getSymbols("SAM")
big.red.dot <- zoo(85, as.Date("2011-05-05"))
plot(SAM['2011'])
points(  big.red.dot, col="red", pch=19, cex=5  )

This one seems to be straight out of the textbook. ?plot.zoo doesn't contain any examples with point() though.


By default the objects created by quantmod::getSymbols are in fact of class xts. This means your big.red.dot should be a xts object:

big.red.dot <- xts(85, as.Date("2011-05-05"))
plot(SAM['2011'])
points(  big.red.dot, col="red", pch=19, cex=5  )

Adding points to xts plot

0

精彩评论

暂无评论...
验证码 换一张
取 消