Hi,
You could use the function spplot in the sp-pacakge. Use the sp.layout
argument to add the shapefile to the plot. All the data needs to be in
one of the Spatial classes provided by the sp-package. The code could
look something like:
library(sp)
library(maptools)
points = read.table("points
plot() is a base graphics function. You can not use it in a Lattice
context. And also you can not add to a Lattice plot as you tried to
do: you need to use a panel function, or call trellis.focus(). I
suggest you read the Lattice documentation.
This is one way to do it:
library(sp)
xyplot(lat ~
Hi there,
I tried to add a coastline that is imported from a shapefile to a xyplot of
sample points, but I got an error message.
> library(lattice)
> library(maptools)
> xyplot(mud$lat~mud$long, asp="iso", type="p", pch=1, cex=0.01, xlab="",
ylab="")
>
> plot(coastline, add=T)
Error in