[R-sig-Geo] help with 2d- Density plots (ggplot2)

Amao Abduljamiu lekisoft at gmail.com
Fri Jan 15 18:00:20 CET 2016


Dear All, 

I need help with 2d- Density plots (ggplot2)...

I'm trying to plot ecological distribution of some species of organisms i'm
studying over the Arabian/Persian Gulf. Here is a sample of code i've tried,

Backround layer

nc <- get_map("Persian Gulf", zoom = 6, maptype = 'terrain', language =
"English")
ncmap <- ggmap(nc,  extent = "device")

Other layers

  ncmap+
    stat_density2d(data=sample.data3, aes(x=long, y=lat, fill=..level..,
alpha=..level..),geom="polygon")+
    geom_point(data=sample.data3, aes(x=long, y=lat))+
    geom_point(aes(x =50.626444, y = 26.044472), color="red", size = 4)+
    scale_fill_gradient(low = "green", high = "red") + scale_alpha(range =
c(0.00, 0.25), guide = FALSE)

but , i will like to use the stat_density2d to show the distributions of
hundreds of species (which are recorded in columns e.g SP1....SPn) over the
water body rather than just displaying latitude and longitude.

Also, is it possible to restrict my heat map to just the water body ? I'll
appreciate any help and recommendations i can get on this please

I will also appreciate any suggestion on alternative way to achieve this.


Here is a link to stackoverflow where I initially asked the question with an
image of what the problem look like. 

http://stackoverflow.com/questions/34569152/ggplot-stat-density2d-plots-for-
ecological-distribution

Sincerely
Amao
-------------------------------------------
Amao Abduljamiu O.
PhD Candidate - Geology
Earth Sciences Department
King Fahd University of Petroleum and Minerals (KFUPM)
Dhahran, Saudi Arabia
P. O. Box 1723 KFUPM, Dhahran 31261 Saudi Arabia
Tel. office +966 3 860 3240
Mobile: +966 535467527
Skype: lakesido02
Email: amao at kfupm.edu.sa
Alt: lekisoft at gmail.com



More information about the R-sig-Geo mailing list