I have recently converted from S-Plus (Dec Alpha) to R (Mandrake 10.0). The differences are subtle but in some cases not easily converted. My Splus Command plotting deck was over 1200 lines and R has simplified this down to 900 lines so far. I do a lot of mapping with polygons and I am trying to figure out how to increase the default size of the fill boxes in the legend call. Splus had a convienient rectangle call in the Key module that did this. Will I have to use the lattice library for this functionality? Also, how does one get around removing the grey background produce by the following xyplot. The postscript works great but my boss wants the figures for the Microsoft world. Thanks Randy ########Coding used for fill question? dense <- rep(0,length(LTtempmean)) for(i in 1:length(LTtempmean)){ if(LTtempmean[i] < 2)dense[i]=5 else if(LTtempmean[i] >= 2 & LTtempmean[i] < 4)dense[i]=12 else if(LTtempmean[i] >= 4 & LTtempmean[i] < 6)dense[i]=30 else if(LTtempmean[i] >= 6 & LTtempmean[i] < 8)dense[i]=45 else if(LTtempmean[i] >= 8 & LTtempmean[i] < 10)dense[i]=62 else if(LTtempmean[i] >= 10)dense[i]=99} dense <- paste("grey",dense,sep="") axislong <- c(-68,-57) axislat <- c(42,48) par(fig=c(0,1.0,.43,1.0)) plot(axislong,axislat,type='n',xlim=c(-68,-57),err=-1,mgp=c(0,.5,0), ylim=c(41.5,47.5),xlab="",ylab="",xaxt="n",cex=.8) #plot Scotian Shelf Map polygon(long,lat,density=-1,angle=45,border=F,col="grey",err=-1) par(new=T,xaxt="n",yaxt="n") #plot coastline outline lines(longcoast,latcoast) #Shade in Polygons polygon(strlong,strlat,border=T,density=-1,col=dense) polygon(strlong74,strlat74,border=T,density=-1,col=dense[30]) #Draw outlines of Strata polygon(strlong,strlat,border=T,density=0) par(cex=.8) legend(-61.7,42.6, c("Below 2.0","2.0 to 4.0","4.0 to 6.0","6.0 to 8.0","8.0 to 10.0","10 & Above"), fill=c('grey5','grey12','grey30','grey45','grey62','grey99'),ncol=2,bty="o", bg='white') text(-61.7,42.6,"Temperature Anomaly",adj=c(0,0)) ##############Coding used for grey background issue. require(grid) library(lattice) background<-trellis.par.get("background") background$col<-"transparent" trellis.par.set("background",background) caption<-"Figure 4: Time series of sampling depths for 4VW summer surveys. Numbers\nin strip panels indicate strata locations. Closed circles represent one sampled\nstation." #function format.figure<-function(latticePlot,caption){ vp1<-viewport(x=0,y=.08,width=1,height=.8,just=c("left","bottom")) vp2<-viewport(x=0,y=0,width=1,height=.06,just=c("left","bottom")) pushViewport(vp1) print(latticePlot,newpage=F) # grid.rect() popViewport(1) pushViewport(vp2) grid.text(caption,x=.1,just=c("left","bottom"),gp=gpar(cex=.99)) #grid.rect() popViewport(1) } #postscript("fig20.eps",horizontal=F,width=7.0,height=9.3) png("fig20.png", bg = "transparent", width = 480, height = 640,pointsize 12, res = 1200) caption <- "Figure 20: Time series of near-bottom salinities for 4X summer surveys.\nNumbers in strip panels indicate strata locations. Closed circles represent one\nsampled station." randy <- xyplot(xsal~xyr | xstrat,type="p",ylab="Salinity (psu)",xlab="Year",background="white", pch=16,mkh=.03, as.table=T, strip = function(...) strip.default(..., style = 1)) format.figure(randy,caption) dev.off() [[alternative HTML version deleted]]