【发布时间】:2019-12-16 11:05:09
【问题描述】:
我想为 x 轴上的日期标签设置不同的颜色,以便每个月都有不同的颜色。 就像下面的例子。我不知道这样的话题是否已经存在,但我在任何地方都找不到解决方案。
library(plotly)
today <- Sys.Date()
tm <- seq(0, 100, by = 1)
x <- today + tm
y <- rnorm(length(x))
plot_ly(x = ~x, y = ~y, type = 'scatter', mode = 'lines') %>%
layout(
xaxis = list(
type = 'date',
tickformat = "%d %b %Y"
))
【问题讨论】:
-
我的建议对你有什么效果?