Alex Rivera | Logout

How to change color of scatterplot in ggplot2

Asked 2009-09-08T19:46:48.737
10

In ggplot2, how could I change the color of coloring in scatter plot?

Edit
Report

1 Answer

9

check out the ggplot documentation for scale_brewer http://www.had.co.nz/ggplot2/scale_brewer.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")
answered 2009-09-08T19:57:47.107

Your Answer