0

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!

1 Answers1

0

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
  • 43,040
  • 110
  • 45
  • 72
Jonni
  • 533
  • 3
  • 11