使用非默认美学更改ggplot2上的geom_smooth颜色

时间:2017-07-25 18:51:36

标签: r ggplot2 colors

我正在ggplot2上绘制glmer.nb模型,如下所示:

#plot modeled data
p <- ggplot(avg.slice, aes(x =slice.depth.DB, y=MP.kg)) + 
      geom_bar(stat = "identity", fill = pallete12, width = slice.width.DB) +     
        scale_x_reverse() + 
          coord_flip() +  
            geom_errorbar(aes(ymin=MP.kg-ci, ymax=MP.kg+ci)) +
              geom_smooth(data=site.pred, aes(x=Depth, y=pred.site, color = Station), stat = "identity") +   #adds model from predictions
                  xlab ("Sediment Depth (cm)") +
                    ylab (expression(paste("Microplastic Concentration (microplastic kg"^"-1"*")")))

产生以下图表: Plot

我想改变电台的颜色,但我无法弄清楚如何。我试过了:

pallete_station<-colorRampPalette(brewer.pal(12, "Paired"))

pallete13<-pallete_station(13)

p + scale_color_manual(pallete13)

但是我收到以下错误:

Error in f(...) : argument "values" is missing, with no default

我认为问题是由于工作站被映射到默认的不同aes,但我无法弄清楚如何调整此工作。

0 个答案:

没有答案
相关问题