[R] plotting points over a map using R
Jim Lemon
jim at bitwrit.com.au
Fri Jan 31 21:03:01 CET 2014
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
More information about the R-help
mailing list