Skip to content
Prev 18726 / 29559 Next

help: density map

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: