[英]Plotly: How to set different colors for x-axis labels using R?
我想为 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"
))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.