Re: [R] plotting points over a map using R
library(RgoogleMaps); # download a static map from the Google server library(geomapdata);# Topographic and Geologic Mapping lbrary(PBSmapping); # Draw Maps and Implement Other GIS Procedures STEP1: my_map = GetMap(center=my_center, zoom =my_zoom , destfile=my_out_file ,maptype = mapmaker-hybrid, size=c(640,640)); ?GetMap for more info STEP2: You can add text = tmp = TextOnStaticMap(my_map,lat = my_markers_1[,lat], lon = my_markers_1[,lon], labels=as.character(site_names), col=red, cex=1.1, add=F) # STEP 3: you can add points tmp = PlotOnStaticMap(my_map,lat = my_markers[,lat], lon = my_markers[,lon], cex=2.,pch=10,col=c(black), add=T) add=T is importent # STEP 4: You can add lines tmp = PlotOnStaticMap(my_map,lat = my_markers_2[,lat], lon = my_markers_2[,lon], col=c(blueviolet), add=T, FUN = lines, lwd = 3); I hope will help ! Mohammed On Fri, 2014-01-31 at 09:58 +, 李德磊 wrote: Hello everyone, I have no idea how to plotting points over a map using R, in which the colors of the points stand for the points' value. I'd like to get a map as shown in attachment picture which was plotted using matlab. Does anyone know how to do it using R? Thank you very much for your help in advance. Kind regards,Dli __ 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 and provide commented, minimal, self-contained, reproducible code. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] plotting points over a map using R
The ggmap package (http://journal.r-project.org/archive/2013-1/kahle-wickham.pdf) is also quite good. Best, Ista On Fri, Jan 31, 2014 at 6:23 AM, Mohammed Ouassou mohammed.ouas...@statkart.no wrote: library(RgoogleMaps); # download a static map from the Google server library(geomapdata);# Topographic and Geologic Mapping lbrary(PBSmapping); # Draw Maps and Implement Other GIS Procedures STEP1: my_map = GetMap(center=my_center, zoom =my_zoom , destfile=my_out_file ,maptype = mapmaker-hybrid, size=c(640,640)); ?GetMap for more info STEP2: You can add text = tmp = TextOnStaticMap(my_map,lat = my_markers_1[,lat], lon = my_markers_1[,lon], labels=as.character(site_names), col=red, cex=1.1, add=F) # STEP 3: you can add points tmp = PlotOnStaticMap(my_map,lat = my_markers[,lat], lon = my_markers[,lon], cex=2.,pch=10,col=c(black), add=T) add=T is importent # STEP 4: You can add lines tmp = PlotOnStaticMap(my_map,lat = my_markers_2[,lat], lon = my_markers_2[,lon], col=c(blueviolet), add=T, FUN = lines, lwd = 3); I hope will help ! Mohammed On Fri, 2014-01-31 at 09:58 +, 李德磊 wrote: Hello everyone, I have no idea how to plotting points over a map using R, in which the colors of the points stand for the points' value. I'd like to get a map as shown in attachment picture which was plotted using matlab. Does anyone know how to do it using R? Thank you very much for your help in advance. Kind regards,Dli __ 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 and provide commented, minimal, self-contained, reproducible code. __ 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 and provide commented, minimal, self-contained, reproducible code. __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] plotting points over a map using R
On 01/31/2014 08:58 PM, 李德磊 wrote: Hello everyone, I have no idea how to plotting points over a map using R, in which the colors of the points stand for the points' value. I'd like to get a map as shown in attachment picture which was plotted using matlab. Does anyone know how to do it using R? Thank you very much for your help in advance. Kind regards,Dli Hi Dli, Your question involves two things, the placement of the points and their color. The coordinate system of maps is almost always geographic, in decimal degrees. The x values are the longitudes measured from the prime meridian that passes through Greenwich, England. The y values are the latitudes that are measured from the equator. To get the colors for the points, if you have some value like average temperature for the points, you can convert the numbers into colors using functions like color.scale in the plotrix package. The resulting vector or matrix of colors can then be passed to the points function. Jim __ 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 and provide commented, minimal, self-contained, reproducible code.
Re: [R] plotting points over a map using R
Try reading the R Spatial Task View: http://cran.r-project.org/web/views/Spatial.html or this brilliant intro, and other files in that github repository: https://github.com/Robinlovelace/Creating-maps-in-R/blob/master/intro-spatial.md or any of the tutorials I've written on the subject! Barry On Fri, Jan 31, 2014 at 9:58 AM, 李德磊 dele...@hotmail.com wrote: Hello everyone, I have no idea how to plotting points over a map using R, in which the colors of the points stand for the points' value. I'd like to get a map as shown in attachment picture which was plotted using matlab. Does anyone know how to do it using R? Thank you very much for your help in advance. Kind regards,Dli __ 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 and provide commented, minimal, self-contained, reproducible code.