![](/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.