[R-sig-Geo] Marginless plot output for georegistration of output graphics
David Forrest
drf5n at maplepark.com
Wed Jan 17 18:58:55 CET 2007
On Wed, 17 Jan 2007, David Forrest wrote:
> On Wed, 17 Jan 2007, Roger Bivand wrote:
...
> I feel really close with this, except for the key.
Answering my own question by looking through the source at
http://r-spatial.cvs.sourceforge.net/r-spatial/sp/R/spplot.R?view=markup I
see that spplot uses levelplot for many of its plots and will then accept
a colorkey=FALSE argument to inhibit the keys. So, for everything but
SpatialPointsDataFrames, maybe something like this would work:
library(maptools)
xx <- readShapePoly(system.file("shapes/sids.shp", package="maptools")[1],
IDvar="FIPSNO", proj4string=CRS("+proj=longlat +ellps=clrk66"))
xx.p<-spplot(xx,'AREA',
par.settings=theme.novpadding, # lattice theme from prior
scales=list(axs='i',draw=FALSE),
xlim=bbox(xx)[1,],ylim=bbox(xx)[2,],colorkey=FALSE)
mywidth<-myheight<-600
if(mapasp(xx)>1) mywidth <-myheight / mapasp(xx)
if(mapasp(xx)<1) myheight <-mywidth * mapasp(xx)
tf2<-tempfile()
png(file=tf2,width=mywidth,height=myheight,bg='transparent')
print(xx.p)
dev.off()
system(paste("display", tf2))
What do I need to to do turn the key off for spplot(SpatialPointsData) ?
Dave
--
Dr. David Forrest
drf at vims.edu (804)684-7900w
drf5n at maplepark.com (804)642-0662h
http://maplepark.com/~drf5n/
More information about the R-sig-Geo
mailing list