STATISTICA







STATISTICA BASIC Program Dotplot.stb

[Graph] { This program will produce a "dot-plot" of values for a list of variables;

Program written, modified, or edited at StatSoft, Inc.}


randomaccess;
NoDataFileVariableNames;
    redim xdata(ncases);
    redim ydata(ncases);
    redim var(nvars);
    largeconstant:=-1.e+30;
    delta:=1.e-4;
    plotspergraph:=3;

    if (SelectVariables1 ('Select Variables', 1,
      nvars, var, n, 'Variables:')=0) then stop;
{accept minimum delta for identifying identical points}
    if(DisplayNumericInputBox ('Enter minimum difference for points',
	'Minimum difference', delta)=0) then stop;
      imethod:=1;
      if (n>1) then begin
	 imethod:=3-DisplayButtonBox ('Select graph type',
       'Make compound graphs|Make individual graphs');
	 if imethod=3 then stop;
 	end;
{process variables}
    imaster:=1;
    for ivar:=1 to n do begin
	MatrixCopy (data, 1, var(ivar), ncases, 1, xdata, 1, 1);
	VectorSort (xdata, SORT_DESCENDING);
	mcases:=0;ycases:=0;xold:=largeconstant;
      maxy:=0;xvalue:=largeconstant;
	for i:=1 to ncases do begin
	 mcases:=mcases+1;
	 if abs(xdata(i)-xold)>delta then ycases:=1;
	 if ycases=1 then xvalue:=xdata(i);
	 xold:=xvalue;
	 xdata(i):=xvalue;
	 ydata(i):=ycases;
       maxy:=max(maxy,ycases);
	 ycases:=ycases+1;
	end;
	Graph:=NewGraph (SCATTERPLOT,
       'Distribution for variable: '+varname(var(ivar)),
	 '', varname(var(ivar)), mcases, Xdata, Ydata);
      GraphSetScaling (Graph, AX_Y, SCALING_MANUAL_0,
  	  .8, maxy+1, max(trunc((maxy+1)/4),1));
      GraphSetScaling (Graph, AX_RY, SCALING_MANUAL_0,
  	  .8, maxy+1, max(trunc((maxy+1)/4),1));
	if imethod=2 then begin
       if imaster=1 then
		master:=NewGraph (IGNOREDPLOT, '', '', '', 0, xdata, ydata);
	 GraphEmbedGraph (master, Graph, FALSE, FALSE, ?MappingMode,
	     0,
          100-imaster*100/plotspergraph, 100,
          100-(imaster-1)*100/plotspergraph,
	    false);
	 imaster:=imaster+1;
	 if imaster>plotspergraph then imaster:=1;
	end;
    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.