scale_party {ggredist} | R Documentation |
Partisan scales for ggplot2
Description
Partisan scales for ggplot2
Usage
scale_fill_party_c(
name = "Vote share",
midpoint = 0.5,
limits = 0:1,
labels = label_party_pct(),
oob = scales::squish,
reverse = FALSE,
...
)
scale_color_party_c(
name = "Vote share",
midpoint = 0.5,
limits = 0:1,
labels = label_party_pct(),
oob = scales::squish,
reverse = FALSE,
...
)
scale_fill_party_d(labels = c("Rep.", "Dem."), reverse = FALSE, ...)
scale_color_party_d(labels = c("Rep.", "Dem."), reverse = FALSE, ...)
scale_fill_party_b(
name = "Vote share",
midpoint = 0.5,
limits = 0:1,
labels = label_party_pct(),
oob = scales::squish,
reverse = FALSE,
nice.breaks = FALSE,
...
)
scale_color_party_b(
name = "Vote share",
midpoint = 0.5,
limits = 0:1,
labels = label_party_pct(),
oob = scales::squish,
reverse = FALSE,
nice.breaks = FALSE,
...
)
scale_colour_party_d(labels = c("Rep.", "Dem."), reverse = FALSE, ...)
scale_colour_party_c(
name = "Vote share",
midpoint = 0.5,
limits = 0:1,
labels = label_party_pct(),
oob = scales::squish,
reverse = FALSE,
...
)
scale_colour_party_b(
name = "Vote share",
midpoint = 0.5,
limits = 0:1,
labels = label_party_pct(),
oob = scales::squish,
reverse = FALSE,
nice.breaks = FALSE,
...
)
Arguments
name |
Name for scale. Default is |
midpoint |
Scale midpoint value. Default is |
limits |
Lower and upper limits for scale. Default is |
labels |
Function to adjust scale labels. Default is |
oob |
Function to deal with out of bounds. Default is |
reverse |
Whether to reverse red and blue. |
... |
Additional arguments to |
nice.breaks |
If |
Value
ggplot scale function
Examples
library(ggplot2)
data(oregon)
ggplot(oregon, aes(fill = ndv / (ndv + nrv))) +
geom_sf(size = 0) +
scale_fill_party_c(limits=c(0.3, 0.7)) +
theme_map()
ggplot(oregon, aes(fill = ndv / (ndv + nrv))) +
geom_sf(size = 0) +
scale_fill_party_b() +
theme_map()
[Package ggredist version 0.0.2 Index]