cross
cross

Reputation: 1068

Is it possible to change the default color of the items in scale_size in ggplot2?

I would like to change the default color of the scale_size_manual() in ggplot2 independent of the type of the data in the dataframe.

Is this possible?

For example I would like all of the items in the size legend to be of color "red".

Upvotes: 0

Views: 556

Answers (1)

joran
joran

Reputation: 173627

Try this:

> p <- ggplot(mtcars,aes(x = mpg,y = disp,size = cyl)) + geom_point()
> p + scale_size_continuous(guide = guide_legend(override.aes = list(colour = "red")))

Oddly, override.aes seems to not like the American spelling of color. Might have to track that down and submit a small patch...

Upvotes: 2

Related Questions