R-usmap: how to change the label to be smaller? How to put the label underneath the map? How to have the map margin space smaller? Thanks a lot!
Asked
Active
Viewed 565 times
1 Answers
2
You can put the legend at the bottom like this:
library(usmap)
df2 <- usmap::statepop
df2$diffProviderPerFFS <- runif(nrow(df2), -0.2, 0.5)
plot_usmap(data = df2, values = "diffProviderPerFFS", color = "white") +
scale_fill_continuous(name = "Provider Per 1000 FFS(2017-2016)",
low="light green",
high="dark green",
label = scales::comma) +
theme(legend.position = "bottom")
Changing this will automatically create more space for your map to move into. However, in general, the best way to change the size of the legend relative to the nap is to make your plotting window bigger. Look what happens to the relative sizes when I shrink the same plot window down:
And now I make it take up my whole screen width:
This is because the legend stays the same size, but the map expands to fit the rest of the plotting window (it looks smaller in the last image because the whole picture had to be shrunk down to fit on this page.

Allan Cameron
- 147,086
- 7
- 49
- 87