Aragorn64
Aragorn64

Reputation: 129

Plot US map in R without Alaska and Hawaii

Anyone knows how can I plot a US map in R without the states of Alaska and Hawaii?

I have tried with plot_usmap and ggplot2, but I can't remove those states from the plot.

Thank you :)

Upvotes: 1

Views: 1941

Answers (1)

dc37
dc37

Reputation: 16178

You can use exclude argument in plot_usmap:

library(usmap)
plot_usmap(data = statepop, values = "pop_2015",
           exclude = c("AK","HI"))

# Without any fillings:
plot_usmap(exclude = c("AK","HI"))

enter image description here

Using ggplot2, you can directly load the US states by doing:

library(ggplot2)

us <- map_data("state")
ggplot()+
  geom_map(data = us, map = us, 
           aes(x = long, y = lat, map_id=region))

enter image description here

Upvotes: 2

Related Questions