In ggplot2, how could I change the color of coloring in scatter plot?
+1
A:
check out the ggplot documentation for scale_brewer http://www.had.co.nz/ggplot2/scale%5Fbrewer.html
some examples:
#see available pallets:
library(RColorBrewer)
display.brewer.all(5)
#scatter plot
dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
d <- qplot(carat, price, data=dsamp, colour=clarity)
dev.new()
d
dev.new()
d + scale_colour_brewer(palette="Set1")
dev.new()
d + scale_colour_brewer(palette="Blues")
Ian Fellows
2009-09-08 19:57:47