0

I have successfully made some maps in R using ggplot but need help changing the scale of the legend so that all the four maps i made have the same scale.

Here is my code for one of my maps:

invmap0206 <- ggplot(invLAmap0206, aes(long, lat, group = group)) +
                geom_polygon(aes(fill = wnvrate0206), colour = "grey50") + 
                ggtitle("WNV NID Rates 2002-2006 by Louisiana Parish") +
                coord_quickmap()
              
              
invmap0206_2 <- invmap0206 + scale_fill_gradient(name = "Rate per 100,000", low = "lightblue", high = "darkblue", na.value = "grey50") +
                theme(axis.text.x = element_blank(),
                      axis.text.y = element_blank(),
                      axis.ticks = element_blank(),
                      axis.title.x = element_blank(),
                      axis.title.y = element_blank(),
                      rect = element_blank())
              
invmap0206_2

Here is the result:

enter image description here

I would like the scale to be 0-8. Any help would be appreciated.

  • 1
    Try adding `limits=c(0,8)` to `scale_fill_gradient()`. It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. – MrFlick Mar 17 '22 at 17:16
  • This solution worked. Thank you so much and my apologies for not adding a reproducible example! Will do that next time. –  Mar 17 '22 at 19:58

0 Answers0