Setting ggplot2 default color scales


ggplot2 is a very nice R plotting library, however some people do not like the default color scales for plots. You can explicitly set the color scale for each one of your plots, but a better solution would be to simply change the defaults.

​Warning in rm(scale_colour_discrete): object 'scale_colour_discrete' not
found
#default colors
qplot(data=iris, Petal.Length, Petal.Width, color=Species, size=I(4))

plot of chunk ggplot_default_color_scales_Title

#change default without arguments
scale_colour_discrete <- scale_colour_grey
last_plot()

plot of chunk ggplot_default_color_scales_Title

#change default with arguments
scale_colour_discrete <- function(...) scale_color_brewer(palette="Set1")
last_plot()

plot of chunk ggplot_default_color_scales_Title


Comments