Questions tagged [usmap]

An R package to support the creation of US maps in the R language.

57 questions
7
votes
2 answers

Add points to usmap with ggplot in r

I was able to create a US map with this tutorial. When I tried to add additional points to it they all ended up in South Dakota, no matter what I input for data. library(ggplot2) library(usmap) testData <- data.frame(LATITUDE = 20.31557, LONGITUDE…
MikeF
  • 764
  • 9
  • 26
3
votes
2 answers

How merge specific states together by group with one label in ggplot2 in R?

I want to plot Electric grid map for U.S. So I need to merge specific states together . I want to plot border for those state together but it not working. Also just one label per each group. This is my data :…
Arwen
  • 77
  • 4
3
votes
1 answer

Tmap: Cannot create school district map for national level

I want to plot school districts on a national map in R using the library Tmap. I used a shapefile from the official website, the National Center for Education Statistics, for school district boundaries. Please note that I used the 2019 file instead…
Kob
  • 147
  • 1
  • 11
3
votes
1 answer

R how to specify custom color gradients with breakpoints

I'm trying to create a custom gradient scale in R that will change colors based on values. Basically: I want the fill color to be a gradient between darkblue and blue for values that are between 1 and 50. I want the fill color to be a gradient…
user1274820
  • 7,786
  • 3
  • 37
  • 74
3
votes
2 answers

How to label numbers instead of names using usmap?

I know usmap has an option label in plot_usmap(). Instead of state names, I want to label some numbers. I guess there should be data related to the coordinate of the state centroids in usmap but I am not sure how to find it. If I can get…
Dan
  • 103
  • 7
3
votes
1 answer

Creating a map plot in R using plot_usmap package

I have a dataset containing different states, zip codes, and claim counts each in separate columns. I am trying to create a plot to show the total claim count according to zip codes for the state of MA. Dataset: I used this to filter by…
nathan
  • 191
  • 3
  • 11
3
votes
0 answers

usmap ggplot2 - mapping USA counties, legend title difficulties

I am using the usmap library which seems to do a great job of mapping counties in R. However, I have 1 issue, the legend titles for maps of factors. Using name in scale_color_gradient(low="green",high="darkgreen",name="My Factor") doesn't…
Chris
  • 1,219
  • 2
  • 11
  • 21
2
votes
1 answer

Using a custom gradient fill based on two different columns

I am trying to have two different fill colors for each US state based on two different columns of my dataset. For this, I am using the counties and coloring half of them which are below the state centroid based on Qt column and another half based on…
M--
  • 25,431
  • 8
  • 61
  • 93
2
votes
1 answer

How do I use ggplot2 to draw a US Map that uses two colors to fill in specific states based on a yes or no variable

Currently, I have this library(usmap) library(ggplot2) plot_usmap(states = "states") + labs(title = "US States", subtitle = "This is a blank map of the counties of the United States.") + theme(panel.background = element_rect(color = "BLACK",…
Anna Alves
  • 21
  • 2
2
votes
1 answer

How to remove the borders in usmap plot

I am trying to make a US election map based on the package 'usmap'. The thing is it seems like the package can only do a white background. If I changed the background colour it would show borders. I tried to remove the borders by setting…
Dan
  • 103
  • 7
2
votes
1 answer

How to specify bin colors for plot_usmap?

I'm looking to create a heat map with a little more control over the color scale, specifically I want to have bins for ranges of values that will correspond to a specific color. Below I provide some sample code to generate some data and make a plot.…
dobothor
  • 23
  • 4
2
votes
1 answer

Discrete values in US map legend using plot_usmap

I am plotting a group of "treatment" counties, using usmap::plot_usmap(), such that treatment=1 for the identified counties an 0 otherwise. I would like the legend to reflect the fact that the variable is discrete (0/1) rather than show a continuous…
Elsa
  • 49
  • 1
  • 6
2
votes
0 answers

Trouble using plot_usmap() function in usmap package

I have decided to brush up on my map making skills and am using the publicly available COVID data from: https://www.kaggle.com/sudalairajkumar/covid19-in-usa Below is my code: USdata <- us_states_covid19_daily %>% group_by(state)%>% …
Angela C
  • 146
  • 1
  • 9
2
votes
1 answer

How do I change state or counties label sizes in R with the function usmap?

I am trying to map New Mexico with each county labeled, but the label size is always much larger than desired. Here is the code I have used so far. plot_usmap("counties", include=("NM"), labels=TRUE, label_color="red") and my map ends up looking…
2
votes
2 answers

Plotting Numerical Values on US Maps

My data is as follows, I call it shortie in the code: State Min Max Average 1 AL 7.0 10.8 8.842857 2 AK 6.9 10.2 8.095238 3 AZ 5.4 10.0 6.623810 4 AR 9.5 15.4 12.157143 5 CA 5.8 7.9 6.309524 6 CO 6.5 9.8 …
subrinarafiq
  • 59
  • 1
  • 8
1
2 3 4