-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
60 lines (46 loc) · 1.97 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# ggredist <a href="https://alarm-redist.org/ggredist/"><img src="man/figures/logo.png" align="right" height="138" /></a>
<!-- badges: start -->
[](https://github.com/alarm-redist/ggredist/actions/workflows/R-CMD-check.yaml)
[](https://lifecycle.r-lib.org/articles/stages.html#stable)
[](https://alarm-redist.r-universe.dev/ui#package:ggredist)
<!-- badges: end -->
`ggredist` provides `ggplot2` extensions for political mapmaking, including
new geometries, easy label generation and placement, automatic map coloring,
and map scales, palettes, and themes.
Here's an example of what you can do with the package.
```{r example}
library(ggredist)
library(ggplot2)
data(oregon)
ggplot(oregon, aes(group=cd_2020)) +
# 'ndv' and 'nrv' contain D and R vote counts
geom_district(aes(fill=ndv, denom=ndv+nrv), linewidth=0.9) +
geom_district_text() +
# can then highlight towns and cities
geom_places(state = 'OR') +
# we can overlay county boundaries and labels
geom_district(aes(group=county), linewidth=0.2, linetype="dashed", fill=NA) +
geom_district_text(aes(group=county, label=toupper(county)),
size=2.2, check_overlap=TRUE) +
scale_fill_party_b(limits=c(0.4, 0.6)) +
theme_map()
```
See more in [the reference](https://alarm-redist.org/ggredist/reference/index.html).
## Installation
You can install the development version of ggredist from [GitHub](https://github.com/) with:
``` r
# install.packages("remotes")
remotes::install_github("alarm-redist/ggredist")
```