用 R 在图中突出显示一个时期

Posted

技术标签:

【中文标题】用 R 在图中突出显示一个时期【英文标题】:Highlight a period in graph with R 【发布时间】:2021-02-05 22:18:55 【问题描述】:

有没有一种简单的方法可以在 R 中突出显示句点?

现在我正在尝试使用以下内容,但它对我不起作用:

library (PerformanceAnalytics)
period <- c("2018-02/2019-01")
chart.TimeSeries(btc_xts, 
                 period.areas = "2018-02/2019-01",
                 period.color = "lightgrey")

因此,我看到了历史图表,但没有突出显示。

附上结果。谁能帮忙?

谢谢!

the result of the action, no highlighting

【问题讨论】:

【参考方案1】:

我从来没有使用过图书馆,而是阅读 period.areas 的文档:

period.areas :这些是由开始和结束日期在向量中描述的阴影区域 xts 日期范围,例如 c("1926-10::1927-11","1929-08::1933-03")

代码应该是:

library(PerformanceAnalytics)
period = c("2018-02::2019-01")
chart.TimeSeries(btc_xts, 
                 period.areas = period,
                 period.color = "lightgrey")

`

【讨论】:

对不起,对我不起作用。使用你或我的方法后,我只看到一个粗体图。 也许有人知道为什么我在这两种情况下都会收到一个粗体图?

以上是关于用 R 在图中突出显示一个时期的主要内容,如果未能解决你的问题,请参考以下文章