library(ggplot2)
library(rgeos)
library(maptools)
library(rgdal)
coast <- readOGR(.../"Alaska_Coast_1000000_py.shp", layer = "Alaska_Coast_1000000_py")
proj4string(coast) <- CRS("+init=epsg:3338")
coast <- spTransform(coast, CRS("+proj=longlat +datum=NAD83"))
coast.df <- fortify(coast, region = "TYPE")
coast.df$long <- ifelse(coast.df$long>0,coast.df$long*-1,coast.df$long) ##fix Aleutian Islands
roads <- readOGR(".../Major_Roads_ln.shp", layer = "Major_Roads_ln")
proj4string(roads) <- CRS("+init=epsg:3338")
roads <- spTransform(roads, CRS("+proj=longlat +datum=NAD83"))
roads$id <- c(1:32) ##create id that allows me join data from original file to fortified data frame - just a guess at methods
roads.df <- fortify(roads, region = "id") ##this is where I would love to be able to specify which roads are which
##this plot doesn't try to color the lines or anything, but is the basis for what I'm hoping to adjust
a4 <- ggplot() +
geom_polygon(data = coast.df, aes(x = long, y = lat, group = group),
color = "gray", size = 0.25, fill = "white") +
geom_path(data = roads.df, aes(x=long, y=lat, group=group), size = 1) + ##could imagine adding color = "road_type" or
scale_color_brewer() +
theme(legend.position = "none",
panel.background = element_blank(),
axis.text.y = element_blank(), axis.ticks.y = element_blank(),
axis.text.x = element_blank(), axis.ticks.x = element_blank(),
axis.title.y = element_blank(), axis.title.x = element_blank())
print(a4)