[R-sig-Geo] help: density map

Wayne Folta wdf61 at mac.com
Thu Jul 4 19:21:43 CEST 2013


Ariel,

Are you wanting to map the density of the raingauges, or are you wanting to interpolate the values of the rain at the rain gauges? KernSmooth will do the former.

In either case, you might want to look at the R package ggplot2, which includes density-plotting mechanisms. Say you have your rain gauge lat's and lon's in a data frame, raindata. You could plot the density of the gauges and overlay the gauge locations with something like:

    ggplot (raindata, aes(x=lon, y=lat)) + geom_density2d () + geom_point () 

If you want to plot the density of the rain instead:

        ggplot (raindata, aes(x=lon, y=lat, z=rainamount)) + stat_contour (geom="polygon", aes(fill=..level..)) + geom_point () 

And if you want to overlay either of these on a Google (or OpenStreetMap) map background, look into the ggmap package, which makes it easy.

   Wayne

On Jul 4, 2013, at 11:32 AM, Ariel Fuentesdi <ariel.fuentesdi at usach.cl> wrote:

> Hello,
> 
> I have raingauges as points and I want to make an heatmap with those
> points. So, I understand I need to do a kernel density estimation, but,
> there are different kernel functions. Thus, my questions is: how do I know
> which kernel function I need to apply to my data? Do I need to run a
> previous test first?
> 
> I believe I can select the function using grass, but how can I do it with
> R? Do I have to use the KernSmooth package? How Can I map that ?
> 
> Regards,
> Ariel
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list