1

I'm new in GGally and I'd like to ask u how to add colours in the different lines of my variables in ggpairs(). Can I give a specific colour for each one?

Thanks!

Claudia RF
  • 11
  • 1

1 Answers1

1

If you just want to add/specify color for groups, you can set these manually using scale_fill_manual or scale_color_manual depending on the type of plot in the upper/lower/diagonal regions of the plot:

library(GGally)
pm <- ggpairs(flea, columns = 2:4, ggplot2::aes(colour=species))

pm +
 scale_color_manual(values = c("red", "blue", "purple")) +
 scale_fill_manual(values = c("red", "blue", "purple"))
Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
Jonni
  • 804
  • 5
  • 16