[R] plotting points over a map using R

Mohammed Ouassou mohammed.ouassou at statkart.no
Fri Jan 31 12:23:43 CET 2014


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 +0000, 李德磊 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 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.




More information about the R-help mailing list