[R-sig-Geo] [R-sig-eco] scatter plot of coordinates
Roland Kaiser
roland.kaiser at sbg.ac.at
Wed Jan 27 16:51:26 CET 2010
Julia,
my preferred way of plotting spatial data
is to use spatial classes as provided by package(sp).
library(sp)
library(maps)
pts <- data.frame(lng = seq(10,15,1),
lat = seq(45,50,1),
date = seq(2000,2005,1))
# coerce to class SpatialPointsDataFrame
coordinates(pts) <- ~lng+lat
# attribute date is stored in slot data
slot(pts, "data") # equivalent to pts at data
map(xlim = c(8,17), ylim = c(43,52))
points(df)
text(df, labels = df at data$date)
Cheers,
Rolond
> Hello!
> I have a dataset with the date and positions - Lat and Long columns
> How do I make a scatter plot?
> Do I have to cbind the Lat and Long columns?
> Any suggestions will be much appreciated!
> Thank you
> Julia
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
More information about the R-sig-Geo
mailing list