/* xfig.M: save 1D as an XFIG plot. */

print "#FIG 2.0\n";
print "80 2\n";

xWidth = 550;
yWidth = 100;
xOff   = 50;
yOff   = 200;
n      = 32;

maxVal = vMax( rdata, size );
minVal = vMin( rdata, size );

if (maxVal == minVal)
   {
    range = 1.0
   }
else
   {
    maxVal - minVal;
   };

(void) printf( "2 1 0 3 0 0 0 0 0.000 0 0\n" );
(void) printf( "\t" );

j = 0;

for( i = 0; i < size; i++ )
   {
    x   = xOff + i*xWidth/n;
    y   = yOff - yWidth*(rdata[i] - minVal)/range;

    (void) printf( " %.0f %.0f", integer(x), integer(y) );

    if (j == 6)
       {
        (void) printf( "\n\t" );
        j = 0;
       };

    j++;
   }

(void) printf( "9999 9999\n" );
