我有识别事件条形图位置的计算;我的计算输出是我的时间序列或索引中的条形图的数目(我可以使用这两种方法)。我的问题是,当我在图表上有超过50条时,我必须数一数条形图来识别感兴趣的条形图。
有没有办法根据我的计算结果,在图表上给感兴趣的条形图加上某种“指标”?
比如说,我的节目显示第三条是一个兴趣栏。有没有什么小窍门可以帮助你用箭头或点来识别图表上的条形图,以避免计算条形图。我意识到时间通常在x轴上,但是当图表有很多条时,你无法从图表上读取时间和日期,即使你很难确定它们是否正确地对齐。
我提供了一个包含5分钟的OHLC AAPL数据,如dput():希望能够告诉R“当您绘制图表时,请在图表上标识第3栏”,我通常使用quantmod包的chartSeries()来创建我的图表,但是我愿意使用其他函数。
dput(AAPL)
structure(c(266, 265.95, 265.93, 265.89, 265.91, 266, 266, 265.96,
265.97, 265.98, 265.93, 265.9, 265.84, 265.86, 265.8625, 265.97,
265.96, 265.89, 265.875, 265.98), .Dim = c(5L, 4L), .Dimnames = list(
NULL, c("Open", "High", "Low", "Close")), index = structure(c(1299962039,
1299962098, 1299962157, 1299962219, 1299962278), tzone = "", tclass = c("POSIXct",
"POSIXt")), tclass = c("POSIXct", "POSIXt"), tzone = "", .indexCLASS = c("POSIXct",
"POSIXt"), .indexTZ = "", class = c("xts", "zoo"))
chartSeries(AAPL) would create an OHLC bar chart with 5 bars.发布于 2014-10-13 14:55:14
AAPL <- structure(c(266, 265.95, 265.93, 265.89, 265.91, 266, 266, 265.96,
265.97, 265.98, 265.93, 265.9, 265.84, 265.86, 265.8625, 265.97,
265.96, 265.89, 265.875, 265.98), .Dim = c(5L, 4L),
.Dimnames = list(NULL, c("Open", "High", "Low", "Close")),
index = structure(c(1299962039, 1299962098, 1299962157, 1299962219, 1299962278),
tzone = "", tclass = c("POSIXct", "POSIXt")),
tclass = c("POSIXct", "POSIXt"), tzone = "",
.indexCLASS = c("POSIXct", "POSIXt"), .indexTZ = "", class = c("xts", "zoo"))
chartSeries(AAPL)
addLines(v=3)
addPoints(3, Cl(AAPL)[3])https://stackoverflow.com/questions/26342477
复制相似问题