Ascii Plotting Procedures Ascii Plotting Procedures These routines can be used to plot data from ascii files. The ascii files are assumed to be data only (no title lines or comments). The data should consist of one or more columns of parameters, one instance per line. The data columns should be separated by spaces. Using these routines, data colums can be plotted against each other as lines or points, and can be sent to the screen or to color postscript (if the plot is not in color, it can be printed on the B&W printers, at least at FNAL). After the plot has been drawn, pgLabel can be used to add title and axis labels. To plot multiple columns against one column, plot the first set of points, and then append each additional set of points. To plot the different data sets in different colors, use pgSci before each plotting routine. So that these techniques will also work for saving plots, the pgEnd routine must be used when you have finished appending to a saved plot. If you do not issue this, the postscript data may not have been flushed to the pgplot.ps file.

There are three utility routines in this file: proc listMax {list}, proc listMin {list}, and proc scantoarray {linevar arrayname}. The first two do the obvious thing, and scantoarray separates all elements of $linevar (separated by spaces) into elements of arrayname(x) starting with arrayname(0).



  • plotFromFile
  • appendFromFile
  • savePlotFromFile
  • plotFromFileWithLimits
  • savePlotFromFileWithLimits
  • plotFromFileLogLin
  • appendFromFileLogLin
  • plotPointsFromFile
  • appendPointsFromFile
  • savePlotPointsFromFile
  • plotPointsFromFileWithLimits
  • savePlotPointsFromFileWithLimits

  • plotFromFile

    
    

    SYNTAX: plotFromFile file xpos ypos

    EXAMPLE: plotFromFile mydatafile 0 1

    Using the file "mydatafile", makes a linear plot of the items in column 1 (on the y axis) vs. the items in column 0 (on the x axis), scaling the plot so that all data points fit on it.


    appendFromFile

    
    

    SYNTAX: appendFromFile file xpos ypos

    EXAMPLE: appendFromFile mydatafile 0 2

    Using the file "mydatafile", appends (to an aleady existing linear plot) a plot of the items in column 2 (on the y axis) vs. the items in column 0 (on the x axis), using the same scaling as the original plot.


    savePlotFromFile

    
    

    SYNTAX: savePlotFromFile file xpos ypos

    EXAMPLE: savePlotFromFile mydatafile 0 1

    Same as plotFromFile, but writes postscript to the file pgplot.ps.


    plotFromFileWithLimits

    
    

    SYNTAX: plotFromFileWithLimits file xpos ypos xmin xmax ymin ymax

    EXAMPLE: plotFromFileWithLimits mydatafile 0 1 0 100 -50 50

    Same as plotFromFile, but the x axis will go from 0 to 100 and the y axis will go from -50 to 50. Parts of the image that are out of range will not be shown.


    savePlotFromFileWithLimits

    
    

    SYNTAX: savePlotFromFileWithLimits file xpos ypos xmin xmax ymin ymax

    EXAMPLE: savePlotFromFileWithLimits mydatafile 0 1 0 100 -50 50

    Same as plotFromFileWithLimits, but the data will be written to the postscript file pgplot.ps.


    plotFromFileLogLin

    
    

    SYNTAX: plotFromFileLogLin file xpos ypos

    EXAMPLE: plotFromFileLogLin mydatafile 0 1

    Same as plotFromFile, but the y axis is in log scale.


    appendFromFileLogLin

    
    

    SYNTAX: appendFromFileLogLin file xpos ypos

    EXAMPLE: appendFromFileLogLin mydatafile 0 1

    Same as plotFromFileLogLin, but appends to a log-linear plot instead of a linear-linear plot.


    plotPointsFromFile

    
    

    SYNTAX: plotPointsFromFile file xpos ypos

    EXAMPLE: plotPointsFromFile mydatafile 0 1

    Same as plotFromFile, but puts dots at each coordinate instead of drawing a line from point to point.


    appendPointsFromFile

    
    

    SYNTAX: appendPointsFromFile file xpos ypos

    EXAMPLE: appendPointsFromFile mydatafile 0 1

    Appends points to a linear-linear file, using the previously defined limits on the x and y axes.


    savePlotPointsFromFile

    
    

    SYNTAX: savePlotPointsFromFile file xpos ypos

    EXAMPLE: savePlotPointsFromFile mydatafile 0 1

    Same as plotPointsFromFile, but sends postscript output to pgplot.ps.


    plotPointsFromFileWithLimits

    
    

    SYNTAX: plotPointsFromFileWithLimits file xpos ypos xmin xmax ymin ymax

    EXAMPLE: plotPointsFromFileWithLimits mydatafile 0 1 0 100 -50 50

    Same as plotPointsFromFile, but scales the x and y axes so that you only see the part of the plot within the given boundaries.


    savePlotPointsFromFileWithLimits

    
    

    SYNTAX: savePlotPointsFromFileWithLimits file xpos ypos xmin xmax ymin ymax

    EXAMPLE: savePlotPointsFromFileWithLimits mydatafile 0 1 0 100 -50 50

    Same as plotPointsFromFileWithLimits, but writes the plot to the postscript file pgplot.ps.