STATISTICA







STATISTICA BASIC Program 4Plot.stb

{ 4-Plot
Dr. Stefan Funke, Braunschweig, Germany (funke@ibm.net)
11/1996
(nothing is guaranteed - use the program at your own risk)
Generates two XY-scatterplots. Corresponding points are marked with identical numbers in both plots.
STATISTICA's selection conditions are taken into account to enable the user to define subsets of interest.
As a consequence, the program requires STATISTICA 5.1 or higher to run (because STATISTICA 5 has no SelectionConditions() function). }

RandomAccess;
NoDataFileVariableNames; 
 
ReDim xvar1(NVars),yvar1(NVars);  
ReDim xvar2(NVars),yvar2(NVars); 
ReDim labelvar(NVars); 
ReDim xpts1(NCases),ypts1(NCases); 
ReDim xpts2(NCases),ypts2(NCases); 
ReDim labelval(NCases); 
 
 
SelectVariables2('First XY-Plot: Select variables', 1, 1, xvar1, count1, 'X', 1, 1, 
yvar1,count2, 'Y'); 
 
if ((count1=0) or (count2=0)) then  abort; { skip if no variables were selected } 
 
idxx:=xvar1(1); idxy:=yvar1(1);  
selenabled:=SelectionConditionsGet (incl, selstr$); 
 
idx:=1; 
for i:=1 to NCases do 
begin 
   if (selenabled=0) then sel:=1 else sel:=(SelectionConditions (i)=1); 
   if (sel=1) then 
	begin 
       xpts1(idx):=Data(i,idxx); 
       ypts1(idx):=Data(i,idxy);     
       idx:=idx+1; 
	end; 
end; 
 
SelectVariables2('Second XY-Plot: Select variables', 1, 1, xvar2, count1, 'X', 1, 1, 
yvar2,count2, 'Y'); 
 
if ((count1=0) or (count2=0)) then  abort; { skip if no variables were selected } 
 
idxx:=xvar2(1); idxy:=yvar2(1);  
 
SelectVariables1('Select variable which determines order of labels', 1, 1, labelvar, 
labelcnt, 'Label variable'); 
if (labelcnt=0) then abort; 
idxl:=labelvar(1); 
 
 
 
idx:=1; 
for i:=1 to NCases do 
begin 
 if (selenabled=0) then sel:=1 else sel:=(SelectionConditions (i)=1); 
   if (sel=1) then 
	begin 
       xpts2(idx):=Data(i,idxx); 
       ypts2(idx):=Data(i,idxy); 
       labelval(idx):=Data(i,idxl); 
       idx:=idx+1; 
	end; 
end; 
 
if (idx=0) then abort; 
If (idx>0) then idx:=idx-1;  
 
ReDim labelsort(idx),labelnum(idx); 
 
for i:=1 to idx do  
begin 
   labelsort(i):=labelval(i); 
   labelnum(i):=i; 
end; 
 
VectorDualSort(labelsort,labelnum,SORT_ASCENDING); 
 
handle1:=NewGraph(SCATTERPLOT, 'Subplot1:'+selstr$, VarName(yvar1(1)), 
VarName(xvar1(1)),idx, xpts1, ypts1); 
for i:=1 to idx do 
begin 
  GraphSetDataPointLabel (handle1, 1, labelnum(i), str(i,3,0)); 
end; 
 
handle2:=NewGraph(SCATTERPLOT, 'Subplot2:'+selstr$, VarName(yvar2(1)), 
VarName(xvar2(1)),idx, xpts2, ypts2); 
for i:=1 to idx do 
begin 
  GraphSetDataPointLabel (handle2, 1, i, str(i,3,0)); 
end; 
Back to List of Programs



[StatSoft]
2300 East 14th Street, Tulsa, OK 74104
Phone: (918) 749-1119; Fax: (918) 749-2217

[StatSoft]e-mail: info@statsoft.com

©Copyright StatSoft, Inc., 1984-2004.
StatSoft, StatSoft logo, STATISTICA, SEWSS, SEDAS, Data Miner, SEPATH and GTrees are trademarks of StatSoft, Inc.