[英]Colors in plotly bar graph R
See also Custom colors in R Plotly另请参阅R Plotly 中的自定义颜色
When using a variable for color in a plotly bar graph.在绘图条形图中使用颜色变量时。 How do you change the default color scheme?
如何更改默认配色方案?
library(plotly)
library(dplyr)
p <- ggplot2::diamonds %>% count(cut, clarity) %>%
plot_ly(x = ~cut, y = ~n, color = ~clarity) %>%
layout(barmode = "stack")
p
colors
argument of plot_ly
takes a vector of length numbers of categories: plot_ly
colors
参数采用类别长度数的向量:
p <- ggplot2::diamonds %>% count(cut, clarity) %>%
plot_ly(x = ~cut, y = ~n, color = ~clarity, colors = rainbow(10)) %>%
layout(barmode = "stack")
p
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.