Learn R Programming

colorr (version 1.1.0)

nfl-scales: ggplot2 scales from an NFL team palette

Description

Colour and fill scales that take their colors from an NFL team, the ggplot2 counterpart of nfl.colors. scale_color_nfl is an alias for scale_colour_nfl.

Usage

scale_colour_nfl(set, discrete = TRUE, reverse = FALSE, legacy = FALSE, ...)

scale_color_nfl(set, discrete = TRUE, reverse = FALSE, legacy = FALSE, ...)

scale_fill_nfl(set, discrete = TRUE, reverse = FALSE, legacy = FALSE, ...)

Value

A ggplot2 scale, to be added to a plot with +.

Arguments

set

Character string naming an NFL team. See colorr.teams("nfl").

discrete

Logical. TRUE (the default) builds a discrete scale; FALSE builds a continuous gradient through the team's colors.

reverse

Logical. If TRUE, reverse the color order.

legacy

Logical. If TRUE, use the palette that shipped with colorr 1.0.1.

...

Passed on to discrete_scale when discrete is TRUE, otherwise to scale_fill_gradientn or scale_colour_gradientn.

Author

Charles Crabtree [email protected]

See Also

nfl.colors for the raw palette, colorr.pal for the palette function.

Examples

Run this code
library(ggplot2)

ggplot(mtcars, aes(factor(cyl), mpg, fill = factor(cyl))) +
 geom_boxplot() +
 scale_fill_nfl("lions")   # Detroit Lions

ggplot(mtcars, aes(wt, mpg, colour = hp)) +
 geom_point(size = 3) +
 scale_colour_nfl("lions", discrete = FALSE)

Run the code above in your browser using DataLab