Ggplot adding points in large dataset, looks terrible


#1

Hello, i have a dataet with a set of long and lat, and there are roughly 300k datapoints, my goal is to create a sensible depiction of point distribution across the united states. It looks horrible, is there a way to maybe get density or a sum of points?. I tried the following

ggplot() +
  geom_polygon(data=map_data("usa"),aes(x=long,y=lat,group=group),fill=NA,color="black") + 
  geom_point(data=h1b,aes(x=h1b$lon,y=h1b$lat),color="yellow",size=1)

its from this dataset:


#2

It would help to have an example of the sort of visualization you are aiming for (even for a different dataset), but it sounds like you are maybe looking to make a choropleth map? If so, take a look at the choroplethr family of packages (which build on top of ggplot2).


#3

Thank you so much already, I will definitely look into it and hopefully have no more question ( but i doubt it :slight_smile: )


#4

When :grin: you have more questions, I encourage you to ask them! (but do remember to start a new topic if it’s a new question) I learn a lot from what people ask, even if I don’t know the answer.

A tip: you’ll earn the heartfelt appreciation of your helpers (plus avoid friendly nudges :wink:) if you also read the FAQs on formatting your code and making a reproducible example and follow their advice as best you can.

Good luck!