Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

There was an interesting map on reddit this morning, with a visualisation of latitude and longituge of where people live, on Earth. So I tried to reproduce it. To compute the density, I used a kernel based approch

```> library(maps)
> data("world.cities")
> X=world.cities[,c("lat","pop")]
> liss=function(x,h){
+   w=dnorm(x-X[,"lat"],0,h)
+   sum(X[,"pop"]*w)
+ }
> vx=seq(-80,80)
> vy=Vectorize(function(x) liss(x,1))(vx)
> vy=vy/max(vy)
> plot(world.cities\$lon,world.cities\$lat,)
> for(i in 1:length(vx))
+ abline(h=vx[i],col=rgb(1,0,0,vy[i]),lwd=2.7)``` For the other axis, we use a miror technique, to ensure that -180 is close the +180

```> Y=world.cities[,c("long","pop")]
> Ya=Y; Ya[,1]=Y[,1]-360
> Yb=Y; Yb[,1]=Y[,1]+360
> Y=rbind(Y,Ya,Yb)
> liss=function(y,h){
+   w=dnorm(y-Y[,"long"],0,h)
+   sum(Y[,"pop"]*w)
+ }
> vx=seq(-180,180)
> vy=Vectorize(function(x) liss(x,1))(vx)
> vy=vy/max(vy)
> plot(world.cities\$lon,world.cities\$lat,pch=19)
> for(i in 1:length(vx))
+ abline(v=vx[i],col=rgb(1,0,0,vy[i]),lwd=2.7)``` Now we can add the two, on the same graph
{"ft_lang_label":"__label__en","ft_lang_prob":0.7230424,"math_prob":0.9947332,"size":1808,"snap":"2020-34-2020-40","text_gpt3_token_len":579,"char_repetition_ratio":0.11363637,"word_repetition_ratio":0.19921875,"special_character_ratio":0.32190266,"punctuation_ratio":0.17391305,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9989815,"pos_list":[0,1,2,3,4,5,6],"im_url_duplicate_count":[null,3,null,3,null,3,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-09-18T19:44:51Z\",\"WARC-Record-ID\":\"<urn:uuid:bec9041d-f298-45b1-a7ea-c07f8f4ca6f5>\",\"Content-Length\":\"67110\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:45810d9a-b7db-4aa9-995c-dc615fb151bf>\",\"WARC-Concurrent-To\":\"<urn:uuid:b2278ddb-6e40-402c-b889-288bc6ee705d>\",\"WARC-IP-Address\":\"104.28.8.205\",\"WARC-Target-URI\":\"https://www.r-bloggers.com/where-people-live/\",\"WARC-Payload-Digest\":\"sha1:TTWCHX5OB5JZ3OJGD4SDNYBSSUGKB3GV\",\"WARC-Block-Digest\":\"sha1:HPIL4AKBIX45RFPAXKK3JJGGA3ZM7PSD\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-40/CC-MAIN-2020-40_segments_1600400188841.7_warc_CC-MAIN-20200918190514-20200918220514-00228.warc.gz\"}"}