我创建了自己的主题,现在我还想标准化使用的颜色集。我尝试使用此提要中 Viktor 的回答中提供的列表解决方案来执行此操作:
df <- mtcars
uwvPalet <- c("#0078D2","#003282","#C4D600")
theme_uwv <- function(base_size = 22, base_family = "Verdana"){theme_hc(base_size = base_size, base_family = base_family)%+replace%theme(plot.title = element_text(color = rgb(0, 120, 210)), complete = TRUE)}
theme_uwv2 <- list(theme_uwv, scale_color_manual(values = uwvPalet))
ggplot(df, aes(fill = cyl, x = am, y = mpg)) + geom_bar(position = "dodge", stat="identity") + theme_uwv2()
不幸的是,我得到了错误:
Error in theme_uwv2() : could not find function "theme_uwv2"
有谁知道我该如何解决这个问题?