Skip to content

scatter plot of coordinates

7 messages · Julia Tchernova, Abraham de Alba A., Christian Parker +4 more

#
Julia,

## Lets say that you read your data in and called it x
x<-read.csv("mydata.csv")
## and that dataset had 3 columns in it; date, lat and long
plot(lat~long,x)
## or
plot(x$lat~x$long)
## or
plot(x$long, x$lat)
## for more help with the plot function (additional arguments and the 
like) enter
?plot

-Chris
Abraham de Alba A. wrote:
#
Hi Julia,

I have found that the easiest way to display geographic data in R is
to use a projected coordinate system (like Universal Transverse
Mercator). You can then use plot (x,y) to display a scatterplot of
your points.
The resulting map isn't pretty, but it lets you visualize the data.
The following packages have limited cartographic and map projection
capabilities: maps, mapproj, maptools

Also, the GIS program GRASS is free and quite functional.
http://grass.osgeo.org/

Tammy
On Wed, Jan 27, 2010 at 2:28 AM, Julia Tchernova <tchernova at npolar.no> wrote:

  
    
#
On Wed, 2010-01-27 at 10:28 +0100, Julia Tchernova wrote:
The spatial stack of software will probably be useful here if you need
to think about projections etc. Others have suggested something suitable
for simple graphs but for anything even a bit more advanced, the spatial
software will be helpful.

For example:

require(sp)
dat <- data.frame(X = rnorm(3), lat = c(20,30,40), lon = c(10,20,30))
coordinates(dat) <- c("lon","lat")
plot(dat)
box()
axis(1)
axis(2)
## or
##spplot(dat)

HTH

G