theme_fivethirtyeight()不会更改条形图中的颜色

时间:2016-11-10 04:19:35

标签: r ggplot2 data-visualization

为什么在以下代码中,颜色不会像在fivethirtyeight主题中那样改变?

ggplot(df.long, aes(ROIs, Mean, fill=Methods))+  
geom_bar(stat="identity",position="dodge", width=0.75)+
  theme_fivethirtyeight()+
  scale_color_fivethirtyeight()+
theme(axis.text.x=element_text(angle=20,hjust=1,vjust=1, face="bold", size=9), 
      axis.text =element_text(face="bold"),
      axis.title= element_text(face="bold"),
      legend.position=c(1,1),
      legend.justification = c(1, 1))

1 个答案:

答案 0 :(得分:0)

如何使用scale_fill_fivethirtyeight()代替scale_color_fivethirtyeight()

mtcars$am <- as.factor(mtcars$am)
ggplot(mtcars, aes(cyl, mpg, fill=am))+  
        geom_bar(stat="identity",position="dodge", width=0.75)+
        theme_fivethirtyeight()+
        theme(axis.text.x=element_text(angle=20,hjust=1,vjust=1, face="bold", size=9), 
              axis.text =element_text(face="bold"),
              axis.title= element_text(face="bold"),
              legend.position=c(1,1),
              legend.justification = c(1, 1)) +
        scale_fill_fivethirtyeight()