[英]What are the names of colors of lines in R-plotly?
I'm setting manually the color of lines in plot using plotly. 我使用plotly手动设置绘图中线条的颜色。 I would like to know which are the names of the colors available to use. 我想知道哪些颜色可供使用。
I already know the names of the "basic" colors. 我已经知道“基本”颜色的名称。
As: c("red","blue","green", "yellowgreen",...) as:c(“红色”,“蓝色”,“绿色”,“黄色绿色”,...)
library(dplyr)
library(plotly)
library(magrittr)
color_line = "yellowgreen"
mtcars %>% count(gear) %>%
plot_ly() %>%
add_trace(x = ~gear, y = ~n, name = "Gear",type = "bar") %>%
add_trace(x=~gear, y= ~cumsum(n/sum(n)), type ="scatter",mode="markers+lines" ,
line=list(shape="spline", color = color_line),
marker = list(color = ""),
name = "Cumsum",yaxis = "y2") %>%
layout(yaxis2 = list(tickfont = list(color = color_line),
overlaying = "y",
side = "right"
)
)
Does someone know all the names of colors? 有人知道颜色的所有名称吗?
Greetings all. 大家问候。
Here is a full list of named colors: 这是命名颜色的完整列表:
https://www.w3.org/TR/css-color-3/#svg-color https://www.w3.org/TR/css-color-3/#svg-color
You don't need to use the names, from plotly's docs: 您不需要使用来自plotly的文档中的名称:
a color may be specified as: 颜色可以指定为:
- A hex string (eg '#ff0000') 十六进制字符串(例如'#ff0000')
- An rgb/rgba string (eg 'rgb(255,0,0)') 一个rgb / rgba字符串(例如'rgb(255,0,0)')
- An hsl/hsla string (eg 'hsl(0,100%,50%)') 一个hsl / hsla字符串(例如'hsl(0,100%,50%)')
- An hsv/hsva string (eg 'hsv(0,100%,100%)') hsv / hsva字符串(例如'hsv(0,100%,100%)')
- A named CSS color 一种命名的CSS颜色
I'm not a design expert so whenever I need to choose colors I pick them from a palette or from the picker at htmlcolorcodes . 我不是设计专家,因此每当需要选择颜色时,我都会从调色板或htmlcolorcodes的选择器中进行选择 。 They have a lot of info on how to choose colors also. 他们也有很多关于如何选择颜色的信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.