# NOT RUN {
# }
# NOT RUN {
data(l2010)
# log10 transform both density and intensity
l2010[[1]]<-log10(l2010[[1]])
l2010[[2]]<-log10(l2010[[2]])
library(maps)
x11(width=10)
par(mar=c(7,3,2,3))
plot(0,xlim=c(-180,180),ylim=c(-90,90),type="n",axes=FALSE,xlab="",ylab="")
densityGrid(l2010,pch=".",xrange=c(0,6),zrange=c(2,8),range.cex=c(2,8),
red=c(0,0.5,1),green=c(0,1,0),blue=c(1,0,0),alpha=1)
color.legend(-60,-107,60,-97,c("2","3","4","5","6","7","8"),
rect.col=color.scale(1:7,cs1=c(0,0.5,1),cs2=c(0,1,0),cs3=c(1,0,0),alpha=1),
cex=0.5)
par(xpd=TRUE)
text(0,95,"Lightning strikes 2010")
text(0,-114,"Mean intensity kVA (10^n)",cex=0.5)
points(x=seq(-60,60,20),y=rep(-125,7),pch=".",cex=1:7)
text(x=seq(-60,60,20),y=rep(-132,7),c("<=1","2","3","4","5","6",">6"),cex=0.5)
text(0,-142,"Cell frequency (10^n)",cex=0.5)
par(xpd=FALSE)
map("world",mar=c(7,3,2,3),add=TRUE)
dev.off()
# now only Australia
par(mar=c(7,3,2,3))
plot(0,xlim=c(112,154),ylim=c(-43.8,-11.1),type="n",axes=FALSE,xlab="",ylab="")
densityGrid(l2010,pch=".",xrange=c(0,6),zrange=c(2,8),range.cex=c(2,8),
xlim=c(112,154),ylim=c(-43.8,-11.1),red=c(0,0.5,1),green=c(0,1,0),
blue=c(1,0,0),alpha=1)
color.legend(120,-47,146,-45,c("2","3","4","5","6","7","8"),
rect.col=color.scale(1:7,cs1=c(0,0.5,1),cs2=c(0,1,0),cs3=c(1,0,0),alpha=1),
cex=0.5)
par(xpd=TRUE)
text(133,-9,"Lightning strikes 2010 (Australia)")
text(133,-48.2,"Mean intensity kVA (10^n)",cex=0.5)
points(x=seq(121,145,4),y=rep(-50,7),pch=".",cex=1:7)
text(x=seq(121,145,4),y=rep(-51,7),c("<=1","2","3","4","5","6",">6"),cex=0.5)
text(133,-52,"Cell frequency (10^n)",cex=0.5)
par(xpd=FALSE)
map("world",mar=c(7,3,2,3),xlim=c(112,154),ylim=c(-43.8,-11.1),add=TRUE)
# }
Run the code above in your browser using DataLab