Hi,
I am trying to plot a shape file ?in R. I can do ?it easily using plot or
spplot function. ?But I want plot this map with ?lattice xyplot function.
Any one has any idea? I do not want use "maps" package.
Help will be appreciated...
Thanks
Zia
library(maptools)
library(lattice)
bound<-read.shape("Boundary.shp")
#OR
bound<-readShapePoly("Boundary.shp")
plot(bound)
spplot(bound)
# Or following way
bound<-Map2poly(bound)
xybd<-attr(bound,"maplim")
plot(xybd$x,xybd$y, type="n",asp=1, xlab="", ylab="")
for (i in 1:length(bound)) lines(bound[[i]]) # How do I apply this code in
following ?panel.function of ?xyplot?
windows(width=5, height=5)
xyplot(y~x, as.data.frame(tala),pch=1, cex=.8,col="black",
? ? ?xlab=list("Easting (m)",cex=.9),ylab=list("Northing (m)",cex=.9),
? ? ?aspect = "iso",
? ? ?panel = function(...) {
? ? ? ? ? ? panel.xyplot(...)
? ? ? ? ? ? panel.abline(h = 0:4*5000 + 545000, v= 0:4*5000 + 2650000,
? ? ? ? ? ? col = "light grey")
? ? ? ? ? ? panel.points(coordinates(tala.nr),cex=.95,pch=20, col="black")
? ? ? ? ? ? panel.text(2671000, 563000, cex=1, " (a)")
? ? ? ? ? ? },
)