我想 使用XTS对象添加点,图例和文本 会有这个问题的答案,但显然不是...

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  )

这似乎是直接从教科书中出来的。 ?plot.zoo 不包含任何示例 point() 尽管。

有帮助吗?

解决方案

默认情况下 quantmod::getSymbols 实际上是课堂 xts. 。这意味着你 big.red.dot 应该是一个 xts 目的:

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

enter image description here

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top