Title: | Scales, Geometries, and Extensions of 'ggplot2' for Election Mapping |
---|---|
Description: | Provides 'ggplot2' extensions for political map making. Implements new geometries for groups of simple feature geometries. Adds palettes and scales for red to blue color mapping and for discrete maps. Implements tools for easy label generation and placement, automatic map coloring, and themes. |
Authors: | Cory McCartan [aut], Christopher T. Kenny [aut, cre] |
Maintainer: | Christopher T. Kenny <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.2 |
Built: | 2024-10-25 04:47:14 UTC |
Source: | https://github.com/alarm-redist/ggredist |
This data contains the location, name, and 2020 population of U.S. cities and large towns.
data("cities")
data("cities")
sf
object
name
City name.
state
City state.
pop_2020
City population in 2020
GEOID
Census GEOID for the corresponding Census Designated Place.
geometry
The sf
geometry column containing the geographic information.
data(cities)
data(cities)
Aggregates shapefile according to the group
aesthetic. If just group
is
provided, then by default map regions will be colored by group
so that
adjacent regions do not share a color (set fill
to force a particular
color, or NA
for no fill). If fill
is provided, the values in fill
will be summed within the groups defined by group
. If denom
is provided,
the values in denom
will be summed within the groups defined by group
,
and then used to divide the summed values of fill
. For example, fill
and
denom
can be used together to plot the partisan or demographic
characteristics congressional districts (see examples).
geom_district( mapping = NULL, data = NULL, position = "identity", na.rm = FALSE, is_coverage = FALSE, min_col = FALSE, buffer = 0, show.legend = NA, inherit.aes = TRUE, ... ) stat_district( mapping = NULL, data = NULL, geom = GeomDistrict, position = "identity", na.rm = FALSE, is_coverage = FALSE, min_col = FALSE, buffer = 0, show.legend = NA, inherit.aes = TRUE, ... )
geom_district( mapping = NULL, data = NULL, position = "identity", na.rm = FALSE, is_coverage = FALSE, min_col = FALSE, buffer = 0, show.legend = NA, inherit.aes = TRUE, ... ) stat_district( mapping = NULL, data = NULL, geom = GeomDistrict, position = "identity", na.rm = FALSE, is_coverage = FALSE, min_col = FALSE, buffer = 0, show.legend = NA, inherit.aes = TRUE, ... )
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer |
position |
Position adjustment |
na.rm |
if |
is_coverage |
As in |
min_col |
If |
buffer |
Optionally buffer the merged geometries. Negative values will shrink geometries towards the center and can be used for a "glowing boundary" effect (see examples). |
show.legend |
Should this layer be included in the legends? |
inherit.aes |
If |
... |
Passed onto the underlying geoms. |
geom |
The geometric object to use display the data |
a ggproto
object
library(ggplot2) data(oregon) ggplot(oregon, aes(group=county)) + geom_district() + scale_fill_penn82() + theme_map() ggplot(oregon, aes(group=county, fill=pop)) + geom_district() + theme_map() ggplot(oregon, aes(group=cd_2020, fill=ndv, denom=ndv+nrv)) + geom_district() + scale_fill_party_c(limits=c(0.4, 0.6)) + theme_map() ggplot(oregon, aes(group=county)) + geom_district() + geom_district(buffer=-5000, fill="#ffffffcc", color=NA) + scale_fill_natgeo() + theme_map()
library(ggplot2) data(oregon) ggplot(oregon, aes(group=county)) + geom_district() + scale_fill_penn82() + theme_map() ggplot(oregon, aes(group=county, fill=pop)) + geom_district() + theme_map() ggplot(oregon, aes(group=cd_2020, fill=ndv, denom=ndv+nrv)) + geom_district() + scale_fill_party_c(limits=c(0.4, 0.6)) + theme_map() ggplot(oregon, aes(group=county)) + geom_district() + geom_district(buffer=-5000, fill="#ffffffcc", color=NA) + scale_fill_natgeo() + theme_map()
Aggregates shapefile according to the group
aesthetic and positions labels
for each region defined by group
. By default, labels will be sized in rough
proportion to the available area.
geom_district_text( mapping = NULL, data = NULL, position = "identity", na.rm = FALSE, adjust = 1, check_overlap = FALSE, parse = FALSE, show.legend = NA, inherit.aes = TRUE, ... ) geom_district_label( mapping = NULL, data = NULL, position = "identity", na.rm = FALSE, label.padding = ggplot2::unit(0.25, "lines"), label.r = ggplot2::unit(0.15, "lines"), label.size = 0.25, check_overlap = FALSE, parse = FALSE, adjust = 1, show.legend = NA, inherit.aes = TRUE, ... ) stat_district_coordinates( mapping = NULL, data = NULL, geom = "text", position = "identity", na.rm = FALSE, adjust = 1, show.legend = NA, inherit.aes = TRUE, ... )
geom_district_text( mapping = NULL, data = NULL, position = "identity", na.rm = FALSE, adjust = 1, check_overlap = FALSE, parse = FALSE, show.legend = NA, inherit.aes = TRUE, ... ) geom_district_label( mapping = NULL, data = NULL, position = "identity", na.rm = FALSE, label.padding = ggplot2::unit(0.25, "lines"), label.r = ggplot2::unit(0.15, "lines"), label.size = 0.25, check_overlap = FALSE, parse = FALSE, adjust = 1, show.legend = NA, inherit.aes = TRUE, ... ) stat_district_coordinates( mapping = NULL, data = NULL, geom = "text", position = "identity", na.rm = FALSE, adjust = 1, show.legend = NA, inherit.aes = TRUE, ... )
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer |
position |
Position adjustment |
na.rm |
if |
adjust |
A multiplicative scaling factor for the default label sizes |
check_overlap |
If |
parse |
If |
show.legend |
Should this layer be included in the legends? |
inherit.aes |
If |
... |
Passed onto the underlying geoms. |
label.padding |
Padding around label |
label.r |
Radius of rounded corners |
label.size |
Size of label border (mm) |
geom |
The geometric object to use display the data |
a ggproto
object
library(ggplot2) data(oregon) ggplot(oregon, aes(group=county)) + geom_district() + geom_district_text() + scale_fill_randmcnally() + theme_map() ggplot(oregon, aes(group=cd_2020)) + geom_district(lwd=0.9, color="#442222") + geom_district(aes(group=county), lwd=0.4, lty="dashed", fill=NA) + geom_district_text(aes(group=county, label=toupper(county)), size=2.2, check_overlap=TRUE) + geom_district_text(adjust=2) + scale_fill_penn82() + theme_map()
library(ggplot2) data(oregon) ggplot(oregon, aes(group=county)) + geom_district() + geom_district_text() + scale_fill_randmcnally() + theme_map() ggplot(oregon, aes(group=cd_2020)) + geom_district(lwd=0.9, color="#442222") + geom_district(aes(group=county), lwd=0.4, lty="dashed", fill=NA) + geom_district_text(aes(group=county, label=toupper(county)), size=2.2, check_overlap=TRUE) + geom_district_text(adjust=2) + scale_fill_penn82() + theme_map()
Identifies relevant census places and plots them.
geom_places( mapping = NULL, data = NULL, position = "identity", na.rm = FALSE, state = NULL, show.legend = NA, inherit.aes = TRUE, ... ) stat_places( mapping = NULL, data = NULL, geom = ggplot2::GeomSf, position = "identity", na.rm = FALSE, state = NULL, show.legend = NA, inherit.aes = TRUE, ... )
geom_places( mapping = NULL, data = NULL, position = "identity", na.rm = FALSE, state = NULL, show.legend = NA, inherit.aes = TRUE, ... ) stat_places( mapping = NULL, data = NULL, geom = ggplot2::GeomSf, position = "identity", na.rm = FALSE, state = NULL, show.legend = NA, inherit.aes = TRUE, ... )
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer |
position |
Position adjustment |
na.rm |
if |
state |
state to use. Guesses based on overlap if not provided. |
show.legend |
Should this layer be included in the legends? |
inherit.aes |
If |
... |
Passed onto the underlying geoms. |
geom |
The geometric object to use display the data |
a ggproto
object
library(ggplot2) data(oregon) ggplot(oregon, aes(group = cd_2020)) + geom_district() + theme_map() ggplot(oregon, aes(group = cd_2020)) + geom_district() + theme_map()
library(ggplot2) data(oregon) ggplot(oregon, aes(group = cd_2020)) + geom_district() + theme_map() ggplot(oregon, aes(group = cd_2020)) + geom_district() + theme_map()
Included palettes:
partisan, a perceptually uniform red-white-blue scale
dra, the Dave's Redistricting App classic color palette
penn82, historic categorical color palette from the 1982 published Pennsylvania congressional district map
randmcnally and natgeo, colors taken from Rand-McNally and National Geographic political maps
coast and larch, inspired by natural scenery
fivethirtyeight, FiveThirtyEight-inspired color palette
wiki_dem_pres: Wikipedia Presidential Democratic palette
wiki_rep_pres: Wikipedia Presidential Republican palette
wiki_dem: Wikipedia downballot Democratic palette
wiki_rep: Wikipedia downballot Republican palette
wiki_proposal: Wikipedia proposal support palette
jacksonville, Jacksonville, FL inspired color palette
florida, Florida inspired color palette
washington, Washington Redistricting Commission inspired color palette
alaska, Alaska inspired color palette
ggredist
ggredist
list of character vectors of type palette::palette (which supports a
plot()
, print()
, and pillar
generics for visualization)
For details on Wikipedia-based colors, see https://en.wikipedia.org/wiki/Wikipedia:WikiProject_Elections_and_Referendums/USA_legend_colors.
plot(ggredist$partisan) plot(ggredist$dra) plot(ggredist$penn82) plot(ggredist$randmcnally) plot(ggredist$natgeo) plot(ggredist$coast) plot(ggredist$larch) plot(ggredist$fivethirtyeight) plot(ggredist$wiki_dem_pres) plot(ggredist$wiki_rep_pres) plot(ggredist$wiki_dem) plot(ggredist$wiki_rep) plot(ggredist$wiki_proposal) plot(ggredist$jacksonville) plot(ggredist$florida) plot(ggredist$washington) plot(ggredist$alaska)
plot(ggredist$partisan) plot(ggredist$dra) plot(ggredist$penn82) plot(ggredist$randmcnally) plot(ggredist$natgeo) plot(ggredist$coast) plot(ggredist$larch) plot(ggredist$fivethirtyeight) plot(ggredist$wiki_dem_pres) plot(ggredist$wiki_rep_pres) plot(ggredist$wiki_dem) plot(ggredist$wiki_rep) plot(ggredist$wiki_proposal) plot(ggredist$jacksonville) plot(ggredist$florida) plot(ggredist$washington) plot(ggredist$alaska)
This data contains geometry information for the U.S. Interstate Highway System. It was processed from the U.S. Census Bureau TIGER/Line Shapefile system.
data("interstates")
data("interstates")
sf
object
name
Census Bureau name for the interstate
geometry
The sf
geometry column containing the geographic information.
data(interstates)
data(interstates)
For example, a 45% Democratic vote share becomes "R+10" or "55% R".
label_party_margin(midpoint = 0.5, reverse = FALSE, accuracy = 1) label_party_pct(midpoint = 0.5, reverse = FALSE, accuracy = 1)
label_party_margin(midpoint = 0.5, reverse = FALSE, accuracy = 1) label_party_pct(midpoint = 0.5, reverse = FALSE, accuracy = 1)
midpoint |
Either 0.5, the default, or 0. For |
reverse |
If |
accuracy |
As with scales::number_format |
A labeling function
labeler = label_party_margin(accuracy=0.1) labeler(c(0.3, 0.5, 0.543)) labeler = label_party_margin(reverse=TRUE) labeler(c(0.3, 0.5, 0.543))
labeler = label_party_margin(accuracy=0.1) labeler(c(0.3, 0.5, 0.543)) labeler = label_party_margin(reverse=TRUE) labeler(c(0.3, 0.5, 0.543))
Finds colors for every element of a shapefile so that adjacent elements don't have the same color.
map_coloring(shp, min_coloring = TRUE)
map_coloring(shp, min_coloring = TRUE)
shp |
an |
min_coloring |
if |
an integer vector of the same length as shp
, corresponding to the
coloring.
data(oregon) or_short = oregon[30:50, ] map_coloring(or_short) library(ggplot2) ggplot(or_short, aes(fill = map_coloring(or_short))) + geom_sf() + theme_map()
data(oregon) or_short = oregon[30:50, ] map_coloring(or_short) library(ggplot2) ggplot(or_short, aes(fill = map_coloring(or_short))) + geom_sf() + theme_map()
This data contains geographic, demographic, and political information on the 1,071 census tracts of the state of Oregon.
data("oregon")
data("oregon")
sf
object
county
The county the tract belongs to.
cd_2020
The 2210 congressional district assignment for the tract.
pop
The total population of the tract, according to the 2020 Census.
pop_white
The non-Hispanic white population of the precinct.
ndv
Average number of votes for Democratic candidates in recent statewide elections.
nrv
Average number of votes for Republican candidates in recent statewide elections.
geometry
The sf
geometry column containing the geographic information.
data(oregon) oregon[, 1:6]
data(oregon) oregon[, 1:6]
ggplot2
FiveThirtyEight scales for ggplot2
scale_fill_538(...) scale_color_538(...)
scale_fill_538(...) scale_color_538(...)
... |
additional arguments to |
ggplot scale function
library(ggplot2) data(oregon) ggplot(oregon, aes(fill = ndv / (ndv + nrv))) + geom_sf(size = 0) + scale_fill_538(name = '') + theme_map()
library(ggplot2) data(oregon) ggplot(oregon, aes(fill = ndv / (ndv + nrv))) + geom_sf(size = 0) + scale_fill_538(name = '') + theme_map()
ggplot2
Alaska Color Scales for ggplot2
scale_fill_alaska(...) scale_color_alaska(...) scale_colour_alaska(...)
scale_fill_alaska(...) scale_color_alaska(...) scale_colour_alaska(...)
... |
Arguments passed on to |
ggplot scale function
library(ggplot2) data(oregon) ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_alaska() + theme_map()
library(ggplot2) data(oregon) ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_alaska() + theme_map()
ggplot2
Nature-derived Color Scales for ggplot2
scale_fill_coast(...) scale_color_coast(...) scale_colour_coast(...) scale_fill_larch(...) scale_color_larch(...) scale_colour_larch(...)
scale_fill_coast(...) scale_color_coast(...) scale_colour_coast(...) scale_fill_larch(...) scale_color_larch(...) scale_colour_larch(...)
... |
Arguments passed on to |
ggplot scale function
library(ggplot2) data(oregon) ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_coast() + theme_map() ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_larch() + theme_map()
library(ggplot2) data(oregon) ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_coast() + theme_map() ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_larch() + theme_map()
ggplot2
Dave's Redistricting App classic scale for ggplot2
scale_fill_dra(...) scale_color_dra(...) scale_colour_dra(...)
scale_fill_dra(...) scale_color_dra(...) scale_colour_dra(...)
... |
Arguments passed on to |
ggplot scale function
library(ggplot2) data(oregon) ggplot(oregon, aes(group = county, fill=county)) + geom_district() + scale_fill_dra() + theme_map()
library(ggplot2) data(oregon) ggplot(oregon, aes(group = county, fill=county)) + geom_district() + scale_fill_dra() + theme_map()
ggplot2
Jacksonville and Florida Color Scales for ggplot2
scale_fill_jacksonville(...) scale_color_jacksonville(...) scale_colour_jacksonville(...) scale_fill_florida(...) scale_color_florida(...) scale_colour_florida(...)
scale_fill_jacksonville(...) scale_color_jacksonville(...) scale_colour_jacksonville(...) scale_fill_florida(...) scale_color_florida(...) scale_colour_florida(...)
... |
Arguments passed on to |
ggplot scale function
library(ggplot2) data(oregon) ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_jacksonville() + theme_map() ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_florida() + theme_map()
library(ggplot2) data(oregon) ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_jacksonville() + theme_map() ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_florida() + theme_map()
ggplot2
Historical Pennsylvania Color Scale for ggplot2
scale_fill_penn82(...) scale_color_penn82(...) scale_colour_penn82(...)
scale_fill_penn82(...) scale_color_penn82(...) scale_colour_penn82(...)
... |
Arguments passed on to |
ggplot scale function
library(ggplot2) data(oregon) ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_penn82() + theme_map()
library(ggplot2) data(oregon) ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_penn82() + theme_map()
ggplot2
Rand-McNally and National Geographic Color Scales for ggplot2
scale_fill_randmcnally(...) scale_color_randmcnally(...) scale_colour_randmcnally(...) scale_fill_natgeo(...) scale_color_natgeo(...) scale_colour_natgeo(...)
scale_fill_randmcnally(...) scale_color_randmcnally(...) scale_colour_randmcnally(...) scale_fill_natgeo(...) scale_color_natgeo(...) scale_colour_natgeo(...)
... |
Arguments passed on to |
ggplot scale function
library(ggplot2) data(oregon) ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_randmcnally() + theme_map() ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_natgeo() + theme_map()
library(ggplot2) data(oregon) ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_randmcnally() + theme_map() ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_natgeo() + theme_map()
ggplot2
Washington Redistricting Commission Color Scales for ggplot2
scale_fill_washington(...) scale_color_washington(...) scale_colour_washington(...)
scale_fill_washington(...) scale_color_washington(...) scale_colour_washington(...)
... |
Arguments passed on to |
ggplot scale function
library(ggplot2) data(oregon) ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_washington() + theme_map()
library(ggplot2) data(oregon) ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_washington() + theme_map()
ggplot2
Wikipedia Style Election Map scales for ggplot2
scale_fill_wiki_rep(...) scale_color_wiki_rep(...) scale_fill_wiki_dem(...) scale_color_wiki_dem(...) scale_fill_wiki_rep_pres(...) scale_color_wiki_rep_pres(...) scale_fill_wiki_dem_pres(...) scale_color_wiki_dem_pres(...)
scale_fill_wiki_rep(...) scale_color_wiki_rep(...) scale_fill_wiki_dem(...) scale_color_wiki_dem(...) scale_fill_wiki_rep_pres(...) scale_color_wiki_rep_pres(...) scale_fill_wiki_dem_pres(...) scale_color_wiki_dem_pres(...)
... |
additional arguments to |
ggplot scale function
library(ggplot2) data(oregon) ggplot(oregon, aes(fill = ndv / (ndv + nrv))) + geom_sf(size = 0) + scale_fill_wiki_dem(name = 'Dem Share') + theme_map()
library(ggplot2) data(oregon) ggplot(oregon, aes(fill = ndv / (ndv + nrv))) + geom_sf(size = 0) + scale_fill_wiki_dem(name = 'Dem Share') + theme_map()
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, ... )
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()
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()
Clips the interstates and cities datasets to the bounding box of the map and plots them.
stat_cities( mapping = NULL, data = NULL, geom = ggplot2::GeomSf, position = "identity", na.rm = FALSE, adjust = 1, min_pop = 1e+05, show.legend = NA, inherit.aes = TRUE, ... ) stat_interstates( mapping = NULL, data = NULL, geom = ggplot2::GeomSf, position = "identity", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ... )
stat_cities( mapping = NULL, data = NULL, geom = ggplot2::GeomSf, position = "identity", na.rm = FALSE, adjust = 1, min_pop = 1e+05, show.legend = NA, inherit.aes = TRUE, ... ) stat_interstates( mapping = NULL, data = NULL, geom = ggplot2::GeomSf, position = "identity", na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, ... )
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer |
geom |
The geometric object to use display the data |
position |
Position adjustment |
na.rm |
if |
adjust |
A multiplicative scaling factor for the default label sizes |
min_pop |
The minimum population a city must have had in 2006 to be shown. |
show.legend |
Should this layer be included in the legends? |
inherit.aes |
If |
... |
Passed onto the underlying geoms. |
a ggproto
object
library(ggplot2) data(oregon) ggplot(oregon, aes(group=cd_2020)) + geom_district() + stat_interstates(size=1.4, color="#0044aa55") + stat_cities(geom="text", min_pop=130e3, fontface="bold", adjust=0.8) + scale_fill_penn82() + theme_map()
library(ggplot2) data(oregon) ggplot(oregon, aes(group=cd_2020)) + geom_district() + stat_interstates(size=1.4, color="#0044aa55") + stat_cities(geom="text", min_pop=130e3, fontface="bold", adjust=0.8) + scale_fill_penn82() + theme_map()
Theme for maps which uses the 'Times'
family and has a transparent background.
theme_map(...)
theme_map(...)
... |
additional parameters |
ggplot2 theme
library(ggplot2) data(oregon) ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_penn82() + theme_map()
library(ggplot2) data(oregon) ggplot(oregon, aes(group = county)) + geom_district() + scale_fill_penn82() + theme_map()