Artifact 79cf506d736839ddac775dd29f1a5a98a6499d43ebf4fa863f70d273a38f2f94:


#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dat2ps

# Converts a data file to a ps file

# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1996/08/10 09:52:39  peter
## Initial revision
##
###############################################################

echo Creating $1.ps

# Convert multi-columns into gnuplot format -
# ie stack two columns vertically separated by blank lines
awk '
BEGIN{row=0; col=0}
{ 
  row++;
  x[row] = $1;
  for (col = 2; col <= NF; col++) {
    y[row,col] = $col
  }
}
END {
  cols = col-1;
  rows = row;
  for (col = 2; col <= cols; col++) {
    for (row = 1; row <= rows; row++) {
      print x[row], y[row,col]
    };
  if (col<cols) {
    printf("\n")
  }
  }
}' $1.dat > $1.gdat

gnuplot << EOF
  set terminal postscript
  set output '$1.ps'
  set grid
  set title "$1.dat. Generated by MTT on $(date)"
  plot '$1.gdat' with lines
  exit
EOF


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]