I thought I might start a thread which showcases the graphics abilities of R. I'll start it off with one I just made.

This thread was also inspired by bg and trinker claiming that this could never be done in R.

Of course it can you just won't be able 1) to showcase it in R but it works nice with any non IE browser or 2) do it in ggplot. This is SVG, and its enormously powerful!

(fyi Combining R with SVG and XML can put you in the position to make amazing presentations <- that is sozi, its good, but you can also use jezzyink)

To make graphs like the above and the below, you need to get down and dirty with all the functions at the base of ggplot and beyond (head over to the "darkside").

So I'll start off with this example, I was inspired to improve on it after I saw someone's attempt to do it in ggplot.

Hopefully this hits off and we can share some amazing graphics and code with each other. My next goal will be do show how you can do this in R.

So here is my attempt at making a more realistic "Earth at Night in R, using only base graphics" ;

**For some reason it looks much better in R, so just copy paste the following;**

Code:

```
# Earth at night in R
# took about 30 minutes to code
require(maps)
data(world.cities)
#subset minor and major cities
minmajdat=world.cities[world.cities$pop>10000,]
#subset major cities
majdat=world.cities[world.cities$pop>100000,]
#subset huge cities
hdat=world.cities[world.cities$pop>1000000,]
ranker=rank(world.cities$pop)
par(bg=rgb(0,0,0.025),mex=0.5,mar=c(0,0,0,0))
map("world",col=rgb(0,0,0.55,
alpha=0.05),interior=F,fill=T)
#plot huge cities
points(hdat$lat[ranker]~hdat$long[ranker],col=rgb(0.25,0.25,0,alpha=0.05)
,pch='.',cex=(hdat$pop)^c(1/100))
# illumate the night
for(i in 1:5){
points(jitter(world.cities$lat[ranker],1)~jitter(world.cities$long[ranker],1),
col=rgb(230/255,232/255, 250/255,alpha=0.0075),pch='.',cex=(world.cities$pop)^c(1/100))
}
#create light haze arround minor & major cities
for(i in 1:5){
icol=rgb(0.7,0.7,0.7,alpha=0.02)
points(jitter(minmajdat$lat[ranker],10)~
jitter(minmajdat$long[ranker],10),
col=icol,pch='.',cex=(minmajdat$pop)^c(1/100))
}
#create yellow light haze arround major cities
for(i in 1:6){
icol=rgb(1,1,0,alpha=0.02)
points(jitter(majdat$lat[ranker],10)~
jitter(majdat$long[ranker],10),
col=icol,pch='.',cex=(majdat$pop)^c(1/100))
}
#create bright light haze arround huge cities
for(i in 1:6){
icol=rgb(1,1,1,alpha=0.02)
points(jitter(hdat$lat[ranker],10)~
jitter(hdat$long[ranker],10),
col=icol,pch='.',cex=(hdat$pop)^c(1/100))
}
```

TE