Tang
Tang

Reputation: 303

How can i change color for geom_point in this situation?

Here is the code:

df$ProsperRating..Alpha.<-ordered(df$ProsperRating..Alpha., 
                                  levels = c("AA","A","B","C","D","E","HR"))
ggplot(aes(x=BorrowerAPR,y=LP_InterestandFees),
       data=subset(df,!is.na(ProsperRating..Alpha.)))+
  geom_point(alpha=0.2,aes(color=ProsperRating..Alpha.),position = "jitter")

Here is the resulted plot: enter image description here

But i need to change the color of the points into blues, like this: enter image description here

How can i achieve that ?

Upvotes: 1

Views: 375

Answers (1)

baptiste
baptiste

Reputation: 77096

library(ggplot2)

qplot(x, price, data = diamonds, colour = clarity) +
  scale_colour_brewer(palette="Blues", direction = -1)

produces this

enter image description here

Upvotes: 3

Related Questions