Question

I am plotting points on a map, with the following code

crime_poss_drugs$colorbucket<- as.numeric(cut(crime_poss_drugs$count,c(0,100,200,300,400,500,600,700,800,900,1100,Inf)))
crime_prod_drugs$colorbucket<- as.numeric(cut(crime_prod_drugs$count,c(0,100,200,300,400,500,600,700,800,900,1100,Inf)))
ggmap(Map) +
   geom_point(data = crime_poss_drugs,shape=22,
        aes(x = lon, y = lat, colour=factor(colorbucket)))+
   geom_point(data = crime_prod_drugs,
        aes(x = lon, y = lat,colour=factor(colorbucket)))

But the problem is, there are overlapping points from both the layers of geom_point(). Can any one please suggest me how to avoid overlapping in representation when they are at same latitude longitude position. Thanks for the help in advance.

Était-ce utile?

La solution

Changing the alpha value is a good suggestion. One other option is to jitter the points, ie, add a bit of random noise so they do not collide as much. (This makes more sense in some contexts than others -- it's a substantive question, really.) Check out the geom_jitter docs if you are curious.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top