scale_party | R Documentation |
ggplot2
Partisan scales for ggplot2
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,
...
)
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 |
ggplot scale function
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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.