Map with latitude and longitude for a variable

Hi,
My dataset refers to accidents that there were in america in 2019.
I have a variable with 3 factors (Severity of accidents) and I want to show in a graph to show how the frequency of this variable change according to latitude and longitude, but i'm not able to do a map.
What can i do?

Hi,

Can you provide a reprex to illustrate what you're trying to achieve?

I suspect the following chapter is not what you're looking for, but maybe the R Graphics Cookbook can help you also further?

Hi,
Thank you for your answer, I solved some minutes ago with this code:

usa <- map_data("usa")
ggplot() + geom_polygon(data = usa, aes(x=long, y = lat, group = group),fill="NA",col="black")  +
  coord_fixed(1.3)+  geom_point(data=dati, aes(x=Start_Lng, y=Start_Lat,col=Severity))+
  labs(title = "Fig.6 Map of accidents in America",fill = "Severity") + theme(plot.title = element_text(hjust = 0.5))
1 Like