[19090] in s-news-athena

home help back first fref pref prev next nref lref last post

[S] SP2000, Trellis, and scripts

daemon@ATHENA.MIT.EDU (Rick Ditmars)
Wed Sep 1 18:54:24 1999

Message-Id: <01BEF499.F71625B0.rditmars@geomega.com>
From: Rick Ditmars <rditmars@geomega.com>
To: "'s-news@wubios.wustl.edu'" <s-news@wubios.wustl.edu>
Date: Wed, 1 Sep 1999 16:49:31 -0600
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit


S-Plussers,

WinNT, SP 2000.

I have encountered some interesting behavior trying to automate graphsheet 
production and saving with a script file.  I am attempting to loop through 
a list of parameters, generate a stripplot and histogram for each 
parameter, and save to disk; two pages per graphsheet, one graphsheet per 
parameter.  When I assign the index in the command window (i<-3, for 
example) and block-select and run the guts of the for-loop, every thing 
runs fine.  However, when I run the entire script, I end up with an SGR 
file for each parameter containing one empty page.

Also notice the trellis.par.set()/trellis.par.get() combination.  The only 
way for trellis.par.set() to work is to run trellis.par.get(), leave the 
graphsheet it creates open, and then run trellis.par.set().  If you close 
the sheet before running .set() wierd things happen to the settings.  This 
is the first time I have used these commands, but that seems unusual to me.

On the bright side SP-2000 seems to let you have blank spaces in SGR file 
names, which caused serious problems in 4.5, but helps with automating 
graphsheet production and naming from your data.

script file below:

BG.Wells<-BACKGROUND$Well.Name[BACKGROUND$Test=="Total Dissolved Solids"]
BG.TDS<-BACKGROUND$Result[BACKGROUND$Test=="Total Dissolved Solids"]
BG.Wells.order<-reorder.factor(BG.Wells, BG.TDS, median)
ordered(BACKGROUND$Well.Name)<-levels(BG.Wells.order)

params<-sort(unique(BACKGROUND$Test))
max.i<-length(params)

for(i in c(1,2,3,4,5,6,13,16,17,18,19)){
	trellis.par.get("superpose.symbol")
	trellis.par.set("superpose.symbol", tmp.sym)
	
	guiModify( "GraphSheet", Name = "GSD2",
	GraphSheetColor = "Bright White")
	
	xText<-paste(as.character(params[i])," (mg/l)")

	stripplot(Well.Name~Result, data= BACKGROUND, group=Completion,xlab=xText,
          subset=(Test == as.character(params[i])), jitter=T,
		   panel=function(x,y,subscripts,jitter.data=F,...){
		          if(jitter.data) y<-jitter(y, factor=.75)
		          panel.superpose(x,y,subscripts,...)
			    },
		   key=list(points=(Rows(trellis.par.get("superpose.symbol"), 1:2)),
		            text=list(levels(BACKGROUND$Completion)),
		   		columns=2,
		   		transparent=T))
		
				
	histogram(Result, data=BACKGROUND, subset=(Test == 
as.character(params[i])),
        nint=20, col=5, xlab=xText)

	file.name<-paste(as.character(params[i]),".SGR",sep="")
	sheet.name<-paste(as.character(params[i]))

	guiSave( "GraphSheet", Name = "GSD2",
	NewName = sheet.name,
	FileName = paste("P:\\Client\\Graphics\\Rick's 
Graphs\\",file.name,sep=""))

	guiClose("GraphSheet", sheet.name)
}


Thanks in advance for your help.

Rick Ditmars
Sr. Geophysicist
Geomega
Boulder, CO
rditmars@geomega.com

www.geomega.com
----------------------------------------------------------------

"It was like that when I got here."
-- H. Simpson
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

home help back first fref pref prev next nref lref last post