Hello everybody, I'm trying to understand how to draw a smoothed scatterplot on a geographic map with R. Have a dataframe with point locations (long, lat) and was able to simply plot these points on a shp map by using the maptools package. However, instead of having simply the raw points on the map, I would like to have a "smoothed" scatterplot of the same superimposed on the map. Tried with the smoothScatter function, but really have no idea how to combine the map with the resulting graph. tx in adv marco -- View this message in context: http://r.789695.n4.nabble.com/smooth-scatterplot-and-geo-map-tp3702374p3702374.html Sent from the R help mailing list archive at Nabble.com.
The usual smoothed scatterplot assumes that the x variable (longitude) is fixed and that the y-variable (latitude) is observed with error, and that the mapping is 1 to 1 or 1 to many in that for each value of x you can have at most one y value. These assumptions don't seem to make much sense with positional data. You might consider using xsplines instead (see ?xspline). This draws a curve from point to point in the order of the data and the smoothness (and closeness to the points) depends are the arguments that you specify. This makes more sense for most applications that I can think of for plotting onto a map. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of marco > Sent: Thursday, July 28, 2011 2:09 PM > To: r-help at r-project.org > Subject: [R] smooth scatterplot and geo map > > Hello everybody, > I'm trying to understand how to draw a smoothed scatterplot on a > geographic > map with R. > Have a dataframe with point locations (long, lat) and was able to > simply > plot these points on a shp map by using the maptools package. However, > instead of having simply the raw points on the map, I would like to > have a > "smoothed" scatterplot of the same superimposed on the map. Tried with > the > smoothScatter function, but really have no idea how to combine the map > with > the resulting graph. > tx in adv > marco > > -- > View this message in context: http://r.789695.n4.nabble.com/smooth- > scatterplot-and-geo-map-tp3702374p3702374.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code.
thanks a lot!! -- View this message in context: http://r.789695.n4.nabble.com/smooth-scatterplot-and-geo-map-tp3702374p3702424.html Sent from the R help mailing list archive at Nabble.com.
check smooth.ppp{spatstat} which performs spatial smoothing based on a Gaussian kernel...it has a plot method that may do what you are looking for hope this helps, Leo. On Thu, Jul 28, 2011 at 4:09 PM, marco <marco.milella@aim.uzh.ch> wrote:> Hello everybody, > I'm trying to understand how to draw a smoothed scatterplot on a geographic > map with R. > Have a dataframe with point locations (long, lat) and was able to simply > plot these points on a shp map by using the maptools package. However, > instead of having simply the raw points on the map, I would like to have a > "smoothed" scatterplot of the same superimposed on the map. Tried with the > smoothScatter function, but really have no idea how to combine the map with > the resulting graph. > tx in adv > marco > > -- > View this message in context: > http://r.789695.n4.nabble.com/smooth-scatterplot-and-geo-map-tp3702374p3702374.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]