Color palettes in ggpairs

A short description of the post.

Rodney Dyer https://dyerlab.org (Center for Environmental Studies)https://ces.vcu.edu
2015-03-26

Working on some code and was having a tough time configuring the color palette in GGally since it does not produce a ggplot object. It appears to be a larger problem. So, here is one hack, redefine the ggplot function and change the default palette there. Need to make a dyerlab::palette now…

ggplot <- function(...) ggplot2::ggplot(...) + scale_color_brewer(palette="Set1")
unlockBinding("ggplot",parent.env(asNamespace("GGally")))
assign("ggplot",ggplot,parent.env(asNamespace("GGally")))
require(GGally)
ggpairs(df,columns = 3:7,axisLabels="none",color="color")

Citation

For attribution, please cite this work as

Dyer (2015, March 26). The Dyer Laboratory: Color palettes in ggpairs. Retrieved from https://dyerlab.github.io/DLabWebsite/posts/2015-03-26-color-palettes-in-ggpairs/

BibTeX citation

@misc{dyer2015color,
  author = {Dyer, Rodney},
  title = {The Dyer Laboratory: Color palettes in ggpairs},
  url = {https://dyerlab.github.io/DLabWebsite/posts/2015-03-26-color-palettes-in-ggpairs/},
  year = {2015}
}