![](/img/trans.png)
[英]ggthemes scale_colour_solarized("blue") gives "Error in [[: subscript out of bounds" when applied to a plot
[英]chose colors for scale_colour_colorblind() in ggthemes
我想从ggthemes
选择ggthemes
colorblind_pal()
特定颜色
这有效:
library(ggplot2)
library(ggthemes)
p <- ggplot(mtcars) + geom_point(aes(x = wt, y = mpg,
colour = factor(gear))) + facet_wrap(~am)
p + theme_igray() + scale_colour_colorblind()
现在我想为我的情节选择colorblind_pal()
特定颜色。 我该如何选择它们?
我尝试了以下但没有成功:
my_palette <- palette(c("#000000","#F0E442","#D55E00"))
p + theme_igray() + scale_colour_colorblind(my_palette)
您可以使用scale_color_manual
来手动指定要使用的颜色:
library(ggplot2)
library(ggthemes)
p <- ggplot(mtcars) +
geom_point(aes(x = wt, y = mpg, colour = factor(gear))) +
facet_wrap(~am) +
theme_igray() +
scale_color_manual(values = c("#000000","#F0E442","#D55E00"))
p
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.