Created
March 12, 2019 17:15
-
-
Save sdtaylor/31ad072cb2ce396c777f2e5259d8c67c to your computer and use it in GitHub Desktop.
Straightforward USA map with lat/lon grid.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
basemap = map_data('state') | |
lat_range = c(20,60) | |
lon_range = c(-150,50) | |
ggplot() + | |
geom_polygon(data = basemap, aes(x=long, y = lat, group = group), fill=NA, color='black', size=1.5) + | |
scale_x_continuous(breaks=seq(lon_range[1],lon_range[2],10), minor_breaks = seq(lon_range[1],lon_range[2],1)) + | |
scale_y_continuous(breaks=seq(lat_range[1],lat_range[2],10), minor_breaks = seq(lat_range[1],lat_range[2],1)) + | |
theme_bw() + | |
coord_fixed(1.3) + | |
theme(panel.background = element_rect(fill='white'), | |
panel.grid.major = element_line(color='#0072B2', size=1), | |
panel.grid.minor = element_line(color='#56B4E9', size=0.3), | |
axis.text = element_text(size=25), | |
axis.title = element_text(size=30)) + | |
labs(x='Longitude',y='Latitude') |
Author
sdtaylor
commented
Aug 20, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment