在制作一个图形ggplot
并使用viridis
调色板之后,我想获得一个十六进制颜色代码的列表,这些颜色代码是为该特定图随机选择的所有颜色。那可能吗?
这是数据:
df = data.frame(Cell = c(rep("13a",5), rep("1b",5), rep("5b",5)),
condition = rep(c("a","b","c","d","e"), 3),
variable = c(58,55,36,29,53, 57,53,54,52,52, 45,49,48,46,45))
和情节:
library(ggplot2)
library(viridis)
windows(width=4, height=4 )
ggplot(df, aes(x = condition, y = variable, group = Cell, color = Cell)) +
geom_point(aes(color = Cell))+
geom_line()+
scale_color_viridis(discrete=TRUE)