I have little experience creating maps and trouble understanding all the help documentation. I would like to use usmaps
to create a map of counties in New York State only, with data plotted by county, such as the example below.
library(usmap)
library(viridisLite)
library(tidyverse)
library(grid)
df = as.data.frame(cbind(fips = c("36001", "36003", "36007", "36009", "36011", "36013", "36015", "36017", "36019", "36021", "36023", "36025", "36027", "36029", "36031", "36033", "36035", "36037", "36039", "36041", "36043", "36045", "36049", "36051", "36053", "36055", "36057", "36059", "36063", "36065", "36067", "36069", "36071", "36073", "36075", "36077", "36079", "36083", "36087", "36091", "36093", "36095", "36097", "36099", "36089", "36101", "36103", "36105", "36107", "36109", "36111", "36113", "36115", "36117", "36119", "36121"), number = rnorm(56, 30, 15)))
df$number = as.numeric(df$number)
plot_usmap(include = "NY", regions = "counties", labels = TRUE, data=df, values = "number") + scale_fill_viridis_c(name = "Numbers") + theme(legend.position = "right")
Since I am focusing on one state, I would like it to appear upright. I tried using viewport
such as below:
map = plot_usmap(include = "NY", regions = "counties", labels = TRUE, data=df, values = "number") + scale_fill_viridis_c(name = "Numbers") + theme(legend.position = "right")
print(map, vp=viewport(angle=-16))
However I would like to rotate just the map, but keep the labels and legend how they were. Is there a way to do this? Thanks in advance.