Description Usage Arguments Functions Examples
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.
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)
|
... |
options passed to |
palette |
character, which palette to use. Options are |
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. |
scale_color_phl
: Color scale
scale_fill_phl
: Fill scale
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.