BINGPLOT<-function(bingout,filename,lprint=F) { #produces contour plot of bingham output as postscript file in file "filename" #bingham type 1 case (confidence region is a nice football in lat long rho space) only #note "filename" is a character variable - must be enclosed in quotes #produces Splus list with components xlong, ylat which are the coordinates of the grid matrix #these can be used for Splus function contour if (bingout$icase != 1) stop(message="bingham type 1 case only") pstitle<-paste("S-PLUS Graphics--generated by BINGPLOT; data file:",bingout$filename) ps.options(title=pstitle,command="lpr ",paper="letter",pointsize=10,horizontal=F) postscript(file=filename,print.it=lprint) par(oma=c(0, 0, 1.5, 0),mfrow=c(2,1)) bound<-bingout$bound uppmat<-bingout$uppmat lowmat<-bingout$lowmat nlong<-nrow(uppmat) nlat<-ncol(lowmat) long0<-floor(min(bound[,1])) long1<-ceiling(max(bound[,1])) lat0<-floor(min(bound[,2])) lat1<-ceiling(max(bound[,2])) dlong<-(long1-long0)/(nlong-1) dlat<-(lat1-lat0)/(nlat-1) xlong<-long0+(0:(nlong-1))*dlong ylat<-lat0+(0:(nlat-1))*dlat contour(xlong,ylat,uppmat,xlab="axis longitude",ylab="axis latitude") matlines(bound[,1],bound[,2]) title("upper surface plot",cex=1.0) contour(xlong,ylat,lowmat,xlab="axis longitude",ylab="axis latitude") matlines(bound[,1],bound[,2]) title("lower surface plot",cex=1.0) mtext(outer=T, bingout$filename, side=3,cex=1.5) dev.off() list(xlong=xlong,ylat=ylat) }