我正在Rstudio中进行参数化的markdown,并且无法更改ggplot2生成的条形图的颜色

时间:2018-08-21 14:24:22

标签: r ggplot2

这是我的代码:

a <- ggplot(euro.groups, aes(x = Group, y = average_emp)) +
  geom_bar(aes(fill = params$industry),
           stat = "identity",
           position = "dodge") + 
  ggtitle("% of Employment by Group") +
  xlab("Group") +
  ylab("% Employed in Industry") +
  scale_fill_manual("legend", values = c("EU" = "blue", "Eastern" = "red", 
                    "EFTA" = "green", "Other" = "black")) +
  theme_grey()

在该图上将有四个小节。我可以通过“组”为它们分配不同的颜色吗?谢谢!

0 个答案:

没有答案