Map with latitude and longitude for a variable

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?


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?

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

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.