MDATAPLOT2<-function(fitrot,filename,lprint=F,splot=NULL,proj="mercator",param=NULL,orient=NULL) { #MDATAPLOT without reconstructing to side 1 # plots data as a postscript file in file "filename" # note "filename" is a character variable - must be enclosed in quotes # splot is a vector of sections to be plotted # splot=NULL means to plot all sections in one plot # Mercator projection in the range -80 to 80 # In the alternative, projection, parameters, and orientation can be set as in mapproject library(maps) pstitle<-paste("S-PLUS Graphics--generated by MDATAPLOT; data file:",fitrot$filename) ps.options(title=pstitle,command="lpr ",paper="letter",pointsize=10,horizontal=T) postscript(file=filename,print.it=lprint) if (length(splot)==0) {splot<-(1:fitrot$nsect) sub<-" "} else { splot2<-ifelse((splot%%26)==0,26,splot%%26) sub<-paste("Sections:",paste(LETTERS[splot2],collapse=" "),collapse=" ")} ind<-rep(F,fitrot$ndat) for (i in 1:length(splot)) ind<-ifelse(fitrot$isect==splot[i],T,ind) fside<-fitrot$iside[ind] fsect<-fitrot$isect[ind] flat<-fitrot$xlat[ind] flong<-fitrot$xlong[ind] fndat<-length(fside) fsect2<-ifelse((fsect%%26)==0,26,fsect%%26) fchar<-ifelse(fside==1,letters[fsect2],LETTERS[fsect2]) #rotating side 2 back to side 1 #h<-as.double(1:3) #for (i in 1:fndat) {if (fside[i]==2) { #h<-.Fortran("trans1",flat[i],flong[i],h)[[3]] #h<-t(fitrot$ahat)%*%h #temp<-.Fortran("trans6",h,flat[i],flong[i]) #flat[i]<-temp[[2]] #flong[i]<-temp[[3]] #}} #split plot at either the prime meridian or international date line flong<-ifelse(flong>180,flong-360,flong) flong2<-ifelse(flong<0,flong+360,flong) if (diff(range(flong2))0) xlim<-xlim+dlim*c(-1,1) else ylim<-ylim+dlim*c(1,-1) par(pty="s") matplot(temp$x,temp$y,type="l",lty=2,axes=F,xlim=xlim,ylim=ylim,xaxs="i",yaxs="i") #print axes labels if (diff(limlong)<4) del<-.5 else del<-trunc(diff(limlong)/4) xdiff<-limlong[1]+del*(0:8) xdiff<-xdiff[xdiff<=limlong[2]] if (diff(limlat)<4) del<-.5 else del<-trunc(diff(limlat)/4) ydiff<-limlat[1]+del*(0:8) ydiff<-ydiff[ydiff<=limlat[2]] xbox<-c(xdiff,rep(limlong[2],length(ydiff)),rev(xdiff),rep(limlong[1],length(ydiff))) ybox<-c(rep(limlat[1],length(xdiff)),ydiff,rep(limlat[2],length(xdiff)),rev(ydiff)) temp<-mapproject(xbox,ybox) labels<-c(xdiff,ydiff,rev(xdiff),rev(ydiff)) text(temp$x,temp$y,labels) title(fitrot$filename,xlab=sub) #FINALLY time to plot the data temp<-mapproject(flong,flat) text(temp$x,temp$y,fchar,cex=.6) dev.off() }