【发布时间】:2017-08-26 22:49:27
【问题描述】:
我正在尝试绘制不规则日期的基金价格图表。
例如
salpr = c(1, 1.2, 1.4, 1.6, 2, 5, 7, 9)
# yyyy-mm-dd
saldt = c("2015-01-01", "2015-01-07", "2015-01-14", "2015-02-01",
"2015-03-01", "2015-04-01", "2015-05-01", "2015-06-01" )
dd = data.frame(saldt,salpr)
这是我的努力...
with(dd, plot(saldt, salpr, xaxt="s"))
axis.Date(1, at=seq(min(as.Date(dd$saldt)), max(as.Date(dd$saldt)), by="months"), format="%m-%Y")
text(dd$saldt, dd$salpr+0.5,dd$salpr)
我想使用 plot,因为我无法在我的受控环境中访问 ggplot。
任何帮助表示赞赏。
【问题讨论】:
-
在 R 中管理日期对于初学者来说有点棘手。这个 Eric Zivot 的文档可以帮助你 faculty.washington.edu/ezivot/econ424/…