I want to plot my data over US map and I used plot_usmap package but it not working. this is my data:
dt<- data.frame(fips = c("CA", "AL", "NY","IA", "TX","CA", "AL", "NY","IA", "TX"),
value = c(25, 45, 45, 60, 75,15, 65, 75, 20, 65),
year=c(2000, 2000, 2000, 2000, 2000,2010, 2010, 2010, 2010, 2010))
and this is my code:
plot_usmap(data = dt, values = "value", exclude = c("AK", "HI"))+
scale_fill_continuous(low = "white", high = "red", name = "Ele gen (EJ)", label = scales::comma)+ facet_grid("year")
and this the final map:

While
plot_usmapmakes it easy to draw a quick map I think that in your case building the map from scratch usingggplot2is the way to go.To this end you could first get the raw map data via
us_mapand merge your data to the map data.However, as your data contains multiple years but only some states we have to "complete" the dataset to include observations for each pair of year and state. Otherwise faceting by year will not work. To this end I first split your data by year, merge the single year data to the map data, use
tidyr::fillto fill up the year column and finally bind the datasets by row:EDIT For your real data with data for all states the data preparation is much easier: