scale_color_phl: City of Philadelphia color scales

Description Usage Arguments Functions Examples

View source: R/palette.R

Description

These functions provide ggplot2-compatible color and fill scales using City of Philadelphia colors, available at https://standards.phila.gov/guidelines/design-development/brand-elements/color-palette/. The underlying code is adapted from @drsimonj's tutorial at https://drsimonj.svbtle.com/creating-corporate-colour-palettes-for-ggplot2.

Usage

1
2
3
4
5
scale_color_phl(..., palette = "main", discrete = T, reverse = F,
  pal_list = phl_pal_list, named = F)

scale_fill_phl(..., palette = "main", discrete = T, reverse = F,
  pal_list = phl_pal_list, named = F)

Arguments

...

options passed to scale_color_manual or scale_color_gradientn

palette

character, which palette to use. Options are "main", "dark", "light", "blues" and "grays".

discrete

logical, whether palette is discrete or continuous. Continuous will interpolate between colors; discrete has a maximum number of values.

reverse

logical, whether to reverse the order of the palette.

pal_list

Named list of palettes, used by palette argument. Each element is a vector of hex codes.

named

logical, whether the colors in the palette have names corresponding to the data. This is usually not true.

Functions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(ggplot2)
p <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Species)) +
  geom_point(size = 3)
p + scale_color_phl()

p <- ggplot(iris, aes(Sepal.Width, Sepal.Length, color = Petal.Length)) +
  geom_point(size = 3)
p + scale_color_phl("blues", discrete = F)
p + scale_color_phl("blues", discrete = F, reverse = T)

p <- ggplot(iris, aes(Sepal.Width, Sepal.Length, fill = Species)) +
  geom_point(aes(size = Petal.Width), shape = 21)

p + scale_fill_phl()

p <- ggplot(iris, aes(Sepal.Width, Sepal.Length, fill = Petal.Length)) +
  geom_point(aes(size = Petal.Width), shape = 21)
p + scale_fill_phl("blues", discrete = F)
p + scale_fill_phl("blues", discrete = F, reverse = T)

CityOfPhiladelphia/rphl documentation built on Oct. 30, 2019, 5:44 a.m.