scale_brewer

scale_colour_brewer(name=NULL, palette=1, type="qual", limits=NULL, breaks=NULL, labels=NULL, formatter=identity, ...)
scale_fill_brewer(name=NULL, palette=1, type="qual", limits=NULL, breaks=NULL, labels=NULL, formatter=identity, ...)

Sequential, diverging and qualitative colour scales from colorbrewer.org

See colorbrewer.org for more info

This page describes scale_brewer, see layer and qplot for how to create a complete plot from individual components.

What do you think of the documentation? Please let me know by filling out this short online survey.

Parameters

Parameters control the appearance of the scale. In addition to the parameters listed below (if any), any aesthetic can be used as a parameter, in which case it will override any aesthetic mapping.

Returns

This function returns a scale object.

Examples

> dsamp <- diamonds[sample(nrow(diamonds), 1000), ] 
> (d <- qplot(carat, price, data=dsamp, colour=clarity)) 
  
>  
> # Change scale label 
> d + scale_colour_brewer() 
  
> d + scale_colour_brewer("clarity") 
  
> d + scale_colour_brewer(expression(clarity[beta])) 
  
>  
> # Select brewer palette to use, see ?brewer.pal for more details 
> d + scale_colour_brewer(type="seq") 
  
> d + scale_colour_brewer(type="seq", palette=3) 
  
>  
> RColorBrewer::display.brewer.all(n=8, exact.n=FALSE) 
>  
> d + scale_colour_brewer(palette="Blues") 
  
> d + scale_colour_brewer(palette="Set1") 
  
>  
> # scale_fill_brewer works just the same as 
> # scale_colour_brewer but for fill colours 
> ggplot(diamonds, aes(x=price, fill=cut)) + 
+   geom_histogram(position="dodge", binwidth=1000) + 
+   scale_fill_brewer() 
  

What do you think of the documentation? Please let me know by filling out this short online survey.