Skip to contents

Loads shapefile of coordinates. Each row contains a coordinate of the centroid of the CD, slightly dodged so that points in dense places do not overlap.

Usage

cd_dotmap(year = NULL, congress = NULL)

Arguments

year

Integer vector of years, such as 2025 or c(2025, 2027). For data functions, use Congress start years, rather than election years.

congress

Integer vector of Congress numbers, such as 119 or c(119, 120).

Value

An sf object (single year) or sf/tibble (multiple years).

Details

Supply year or congress. Bundled dotmaps cover Congresses 109-120 (start years 2005-2027).

See also

cd_available() for supported years and Congresses.

Other congressional district functions: cd_available(), cd_boundaries(), cd_hexmap(), cd_mapbox(), cd_names(), cd_normal_vote()

Author

Zoya Ahmer, Shiro Kuriwaki, Cory McCartan

Examples

# load one dataset
cd_dotmap(year = 2011) # is equivalent to loading `shp_dot_2011`
#> Simple feature collection with 435 features and 2 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -6126141 ymin: 291173.2 xmax: 2114265 ymax: 5365506
#> Projected CRS: NAD83 / Conus Albers
#> # A tibble: 435 × 3
#>     cong cd               geometry
#>  * <dbl> <chr>         <POINT [m]>
#>  1   112 AK-01 (-1930590 665506.1)
#>  2   112 AL-01 (781567.5 927403.3)
#>  3   112 AL-02  (931998.2 1009563)
#>  4   112 AL-03  (953621.9 1160400)
#>  5   112 AL-04  (814228.2 1261533)
#>  6   112 AL-05  (822033.5 1337765)
#>  7   112 AL-06  (842743.2 1174582)
#>  8   112 AL-07  (776190.3 1074411)
#>  9   112 AR-01  (429156.5 1393778)
#> 10   112 AR-02  (311722.8 1341145)
#> # ℹ 425 more rows
cd_dotmap(congress = 109)
#> Simple feature collection with 435 features and 2 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -6126143 ymin: 291173.2 xmax: 2114265 ymax: 5365496
#> Projected CRS: NAD83 / Conus Albers
#> # A tibble: 435 × 3
#>     cong cd               geometry
#>  * <dbl> <chr>         <POINT [m]>
#>  1   109 AK-01 (-1930590 665495.7)
#>  2   109 AL-01 (781569.6 927405.5)
#>  3   109 AL-02  (931998.2 1009558)
#>  4   109 AL-03  (953621.9 1160400)
#>  5   109 AL-04  (814233.7 1261533)
#>  6   109 AL-05  (822033.8 1337769)
#>  7   109 AL-06  (842743.4 1174577)
#>  8   109 AL-07    (776185 1074411)
#>  9   109 AR-01  (429156.5 1393778)
#> 10   109 AR-02  (311722.8 1341146)
#> # ℹ 425 more rows
cd_dotmap(year = 2027)
#> Simple feature collection with 435 features and 2 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: -2293073 ymin: 118141.5 xmax: 2073752 ymax: 3105728
#> Projected CRS: NAD83 / Conus Albers
#> First 10 features:
#>    cong    cd                  geometry
#> 1   120 AK-01 POINT (-1935091 654711.1)
#> 2   120 AL-01 POINT (759114.8 900624.8)
#> 3   120 AL-02  POINT (952569.1 1022567)
#> 4   120 AL-03  POINT (943611.4 1199910)
#> 5   120 AL-04  POINT (797017.7 1264878)
#> 6   120 AL-05  POINT (845580.4 1334041)
#> 7   120 AL-06  POINT (868249.5 1145335)
#> 8   120 AL-07  POINT (781060.9 1055083)
#> 9   120 AR-01  POINT (421002.1 1377139)
#> 10  120 AR-02  POINT (328430.9 1351154)

# plot points combined with state outline
library(ggplot2)

cd_dotmap(year = 2005) |>
  ggplot() +
  geom_sf(data = shp_states) +
  geom_sf(size = 1, alpha = 0.5)


# can also use ggforce::geom_circle, extracting x,y coordinates from geom and
# setting a radius e.g. to 150000