r - Changing colours on ggplot2 for geom_smooth with non-default aesthetics -


i plotting glmer.nb model on ggplot2 below:

#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 predictions                   xlab ("sediment depth (cm)") +                     ylab (expression(paste("microplastic concentration (microplastic kg"^"-1"*")"))) 

which yields following graph: plot

i change colours of stations can't figure out how. i've tried:

pallete_station<-colorramppalette(brewer.pal(12, "paired"))  pallete13<-pallete_station(13)  p + scale_color_manual(pallete13) 

but following error:

error in f(...) : argument "values" missing, no default 

i think problem due stations being mapped on different aes default, can't figure out how adjust this.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -