scale_brewerscale_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 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.
name: name of scale to appear in legend or on axis. Maybe be an expression: see ?plotmathpalette: Either numeric or character. If numeric, selects the nth palette of type type. If character, selects the named palette. Get a complete list of all parameters by running \code{RColorBrewer::display.brewer.all(n=8, exact.n=FALSE)}type: Type of scale. One of 'div' (diverging), 'qual' (qualitative, the default), 'seq' (sequential), or 'all' (all). Only used when palette is numeric.limits: numeric vector of length 2, giving the extent of the scalebreaks: numeric vector indicating where breaks should lielabels: character vector giving labels associated with breaksformatter: NULLThis function returns a scale object.
> 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.