To setup PLTDE under Unix, these commands should be placed in your root directory source file .cshrc:
setenv HARDCOPY hardcopy setenv CRT /dev/ttyThis setup will allow you to save TeK output files on disk for later conversion and printing, and to view TeK files on your MAC, IBM or SUN video terminal.
The simplest use of PLTDE is to graph data made in a Fortran program, or obtained from some other research tool. The next likely use of PLTDE is to plot the solutions of ordinary differential equations.
The capabilities of PLTDE under Unix:
P L T D E M A I N O P T I O N S * 1. Gather data 13. Add column=LOG 2. New 2d plot 14. Add column=SMOOTHED 3. New 3d plot 15. Add column=NEWTON QUOTIENT 4. New contour plot 16. Sort rows by column key 5. New 2d stacked plot 17. Combine data (parse) 6. Add curves to this plot *18. Linetype and marker HELP 7. New window *19. PLTDE Manual Page 8. Add, change, move labels 20. Save DATA in a file 9. New axes limits 21. Save TEK PLOT in a file 10. Change ticks *22. Toggle wait after plot 11. Draw straight lines *23. Exit PLTDE (X,Q,E also exit) 12. Draw circles * means option is available Select:
Any user-written Fortran or C executable, stand-alone program a.out can usually be renamed with the special name pltdef to become acceptable to pltde. This program must be in the current directory or the user's path in order to be accessed by pltde.
The simplest example of such a user routine is the following, which writes data for the curve y=sin(a*x) to file fort.99:
PROGRAM PLTDEF WRITE(*,*)'Enter value of a' READ(*,*)A X=0.0 WRITE(99,*) 0,2 DO I=1,20 WRITE(99,*) I,X,SIN(A*X) X=X+0.1 ENDDO ENDIn this example, the output file fort.99 has a column of leaders and two (2) data columns. The header row `0 2' communicates the information that the file has a column of leaders and 2 data columns. An important feature of PLTDEF is the interaction with parameters (in this example, parameter A is set interactively).
A full-featured example of how to write such a user routine can be found in the makefile and sources:
/usr/local/lib/pltde/makefile /usr/local/lib/pltde/pltdef.f /usr/local/lib/pltde/pltdef99.f
A typical use under Unix is to create a directory, copy the three source files mentioned above, then modify the sources to fit the problem at hand. The expected command line to create pltdef is either `make', or for non-makefile users:
f77 pltdef.f -o pltdef
The source file pltdef99.f contains the main program `pltdef' and two routines for creation of the data file fort.99. Also included is a Shampine-Gordon differential equation solver. The program pltdef.f contains a line that reads "INCLUDE 'pltdef99.f'", which is how the source pltdef.f becomes a main program.
There is a source code package for language C: pltdef.c and pltdef99.c. This package uses Numerical Recipes standards for dynamic allocation and Fortran-like indexing of arrays. It contains special versions of the adaptive Bulirsch-Stoer DE solver for systems of ordinary differential equations.
/usr/local/lib/pltde/makefile.pltde /usr/local/lib/pltde/pltdes.f /usr/local/lib/pltde/plot79 library accessThe makefile creates program pltde.exe. Rename this file to pltde and copy it to the system directory, /usr/local/lib/pltde being the recommended choice. This information is provided for use by system administrators - users wanting to graph functions or differential equations should look at pltdef.f, mentioned above.
if test $1 then for a in $* do echo Tek display of $a - press RETURN when done. echo \ 33[?38h cat $a echo \ 33\ 3 read x done else echo tekcat - Display tek source file in TEK window echo usage: tekcat filename echo Cannot find TEK source file $1 fi
if test $1 then $PLT/tekalw $1 $1.ps lpr -Pjwb120 $1.ps else echo tekout - Convert TeK to Postscript and print echo Usage: tekout TeK-filename echo Cannot find TEK source file $1 fi
TERMINAL DATA ENTRY. This method applies for a simple graph based upon a few data items. The method is to type the data file interactively. You are prompted for the values, so we refer you to PLTDE for a trial run.PLTDEF PROGRAM INTERFACE. The external program pltdef is run as a fork from pltde, which expects data file fort.99 to be produced. Data will be loaded from fort.99, upon return to pltde, provided the file exists. As a matter of course, the file fort.99 is deleted prior to each fork to pltdef.
The sample program pltdef.f (or pltdef.c) includes the code /usr/local/lib/pltde/pltdef99.f (or pltdef99.c) in order to write the required data file fort.99. The latter source contains a Shampine-Gordon solver for differential equations. In most applications, it suffices to leave the source code pltdef99.f intact and modify only the function evaluator in pltdef.f.
pltde goes through the following steps when running the user program pltdef:
DATA FILES. The most common way to use PLTDE is to get data from a file. There are two file formats that can be used, plus some others supported by virtue of skipping initial lines and optionally leaders in column 0.
PLTDE FORMAT. The format is a matrix of numbers N row by M columns with column 0 a column of integers are not used as data (they are sequence numbers). Row 1 should start with integer digit 0, followed by some spaces, then the value M. Note that column 0 causes confusion as to the number of columns: the file has M+1 columns total, numbered 0 to M (not 1 to M+1). Below is a data file for a 4x3 matrix. Note in particular the HEADER row which tells how many columns are present, and the column of LEADERS or sequence numbers. Technically, the data file for a 4x3 matrix has 5 rows and 4 columns due to the presence of the HEADER row and LEADERS column. 0 3 1 1.0 2.5 4.1 2 1.1 2.6 4.7 3 1.2 2.3 4.6 4 1.3 2.6 4.4 To make it possible to include other data sets in one file, PLTDE has the convention that a row starting with 1.0e32 or larger is a sentinel to switch data sets. For example, the following is a file for two data sets, which will be plotted as 2 distinct curves in the TeK plot.
0 3 1 1.0 2.5 4.1 This plots as curve set 1 2 1.1 2.6 4.7 3 1.2 2.3 4.6 4 1.3 2.6 4.4 0 1.e32 0.0 0.0 Sentinel line with 1.0e32. 1 2.0 2.3 4.2 This plots as curve set 2. 2 2.1 2.7 4.3 Still, only 3 columns of 3 2.2 2.9 4.1 data for pltde! 4 2.3 2.4 4.0
GRAPH FORMAT. The Unix GRAPH program accepts data files with 2 columns, representing the X and Y values for a data set. PLTDE accepts such files also, with the caveat that items in row 1 contain decimal points. Here's an example for plotting y = 2x+1: 0.0 1.0 For predictable results, row 1 .1 1.2 should contain decimal points. .2 1.4 .3 1.6 .4 1.8 .5 2.0 .6 2.2 .7 2.4 .8 2.6 .9 2.8 1.0 3.0
OTHER FORMATS. The program can skip initial lines and include or exclude the column of leaders. Furthermore, you can specify how many columns to read. This may not be perfect for some kinds of data files. It is suggested that foreign data be converted prior to running PLTDE (this might be done in the external program pltdef).
The order of entry is important. For example, entering 1 3 means you want to use column=1 for the x-axis and column=3 for the y-axis, whereas entering 3 1 plots the inverse graph (which may not be what you wanted).
More than 1 curve can be plotted on a single TeK screen. The curve combinations are accepted until a blank line is entered.
A contour plot is made of Z=f(X,Y) on a rectangle in the plane. Assumed are M=N*N values of Z obtained from N divisions in the X and Y directions (40 < N < 100 is best).
The ordering of Z-values in the data file is important. Starting at a rectangle corner, write the Z-values with an outer loop on Y, and an inner loop on X. For an example of how this is done, the following Gaussian Well data will plot an interesting contour plot:
C Gaussian well data for contour plot C See DEM40 in plot79 sources C PROGRAM GWELL DATA NX / 97 / DATA NY / 97 / DATA NZ / 41 / EX(IARG) = 0.0667*FLOAT(IARG-KX) WY(JARG) = 0.0487*FLOAT(JARG-KY) KX = (6*NX)/10 KY = (4*NY)/10 DO 20 J = 1,NY DO 10 I = 1,NX X1 = EX(I) X2 = WY(J) R1 = EXP(-X1*X1) R2 = EXP(-X2*X2) RR = EXP(-0.25*(X1-X2)*(X1-X2)) WRITE(*,*) TANH(0.4*(-2.0*R1-2.0*R2+RR)) 10 continue 20 continue END
Not in particular that the data file for the Gaussian Well will have just one column: no X and Y values need to be in the data file. PLTDE will gather data from the data file as a foreign file with 1 data column. The contour plot option will produce the TeK output as in the plot79 DEMO40 example.
This technique applies to snapshots of similar curves, for example, the cross-sections of a surface z=u(x,y) for certain values of y, plotted in 2d as z versus x.
There are two data entries in this option. Both require the entry of four (4) real numbers.
The first data entry selects the window for plotting. Expect the data to be clipped if it does not appear in this window of x and y values. Example: Data item x=2.0 y=1.0 will not be plotted if the window is set to 0 <= x <= 1.5, 0 <= y <= 2.0 by the data entry 0 1.5 0 2.0.
The second data item selects the length and placement of the axes in the plot. Expected are 4 numbers like 0.2 0.9 0.15 0.85, all on one line. The numbers supplied select a subrectangle of [0,1]x[0,1] on which to set the axes in the plot. The meaning for the example is: place the x-axis on [0.2,0.9] and the y-axis on [0.15,0.85], so that the axes use 70 percent of the available space ([0.2,0.9] is 70 percent of [0,1]).
The first kind of label is an axis label. This will be placed parallel to the axis in question and centered. A common data entry is a blank line for the label, which erases the label. Other changes are scaling of the font so that the label matches the graph. An axis label may contain the case switch syntax <> of plot79 and also $N or $n to introduce a newline into the title for multi-line titling. Axis labels cannot be repositioned. If you need to do it, then consider the other kind of label below.
The second kind of label is a FREE label, placed at any coordinate in the TeK window. The data entry consists of the label itself, which is a string of characters obeying PLOT79 rules, which allow for upper and lower case characters. Multiline labels using $N or $n newline markers are not supported in this mode (although they are supported in the axes labels described above).
The coordinates used to place the label refer to the ticks on the axes. You may be able to place a label outside the tick limits. For example, it is routine to set a label above the Y-axis and to the right of the X-axis. For example, if the x-scale is 0 to 24, then numbers like -0.5 to 24.5 may be acceptable data. This all depends on the window size and the size of the font being used. Experiment - it might work.
Options exist to modify the label title and position. This works like adding a new label, except data entry has been reduced by defaults already set from the previously entered label.
Finally, a label can be removed. This is often needed after rescaling the window or zooming the axes. Practise will make this seem a little easier: the ordering of events suggested is to get the window size right before adding any labels.
The X and Y axes in a 2d plot are equipped with a default scaling and upper and lower limits. This can be changed in order to display relevant portions of the plot. This change does not change the physical length of the displayed axis: it only changes the numbers under the ticks. Since curves are plotted based on the window of data items allowed by the tick marks, the effect is to chop off the graph.
This option reset by the New Window option, so you may need to redo it after a window and viewport change. Certain changes will not have the desired effect, so experimentation is often needed to get the desired result in the plot.
The basic data entry for the change is 4 numbers on a single line, or a blank line to abort and keep the old values already in effect. The idea to keep in mind is that you cannot by this entry increase the size of the viewport, so all that is allowed, in theory, is a reduction in the axis length of the plot.
Some undesirable side effects of tick mark changes are huge numbers appearing along the axes. Experimentation can minimize the size of the numbers.
x1 x2 y1 y2and all on one line. For example, to draw a line from (0,1) to (2,4) you would enter
0 2 1 4and press RETURN to plot. More than one line can be entered per session, so that several lines get plotted on the TeK screen.
The data entry expected is the circle center (x,y) and the radius r. All three numbers are entered on one line, separated by spaces. A blank line aborts, or if circle data has been entered, a blank line initiates the plot. An abort after data entry is effected by entering asterisk (*) as the first character of the line.
This option originated with the need to smooth out experimental data and it remains a useful tool for handling noisy data sets.
y(i) - y(i-1) ------------- x(i) - x(i-1)This is considered to be the numerical derivative of the data, (although there may be other and better ways to differentiate the data set).
The data entry for this option consists of the two columns to use for the X and Y data, historically entered as Y first then X, all on one line. Example: 2 1 makes a new data column in the 10,000x40 internal matrix by doing Newton quotients with y-values from column=2 and x-values from column=1.
The data entry consists of specifying the column. Note that this option shuffles the rows around, so that further plots are using shuffled data and may not come out as expected. Often, the sort option has to be re-applied to each abscissa as multiple plots are scheduled.
The idea of the parser is to produce a new data column in the 10,000x40 internal matrix by performing interactively specified operations on the data columns of the matrix. Most of what was done in the 1980's can be done easily by the programming language AWK, hence there is not much practical interest in making the parser work.
A more appropriate function for the parser is to provide a way to type in a function definition interactively. This is especially interesting for systems of differential equations. What we need to be able to implement this idea is a good function parser written in language C or Fortran 77.
L I N E T Y P E M A R K E R S T Y L E S 0 solid curve 1:dot 11:swiss cross 1 dashed lines 2:+ 12:bell 2 mark points only 3:* 13:paragraph 3 plot 3-D solid 4:circle 14:dagger lines with hidden 5:x 15:double dagger intersections 6:square 16:spade 7:triangle 17:heart 8:crosshair 18:diamond 9:five-point star 19:club 10:six-point star 20:shamrock
This file is ascii data editable in emacs or pi or vi editors - it is NOT a TeK file that can be used to print out the plot.
The required data entry is a file name or unit number. A blank line quits to the main menu without saving the plot data.
The data entry required is a file name (unit number not used). The name is checked for existence, so that you do not accidently clobber a file with the same name.
The usual convention of a blank file name (RETURN only) applies to abort from this option and return to the main menu.
To regulate this swapping of screens, PLTDE will wait for the entry of a RETURN key after the plot completes. The toggle on the main menu turns this feature on/off. It is initially off for the Unix version because of the heavy use of X-windows, which does not require a manual screen switch. Remote users on MAC or IBM microcomputers may wish to compile their private version of PLTDE to have the wait after plot toggle initially ON.
If you want to suspend the Unix image of PLTDE, then press ctrl-Z during its execution. The fg command under Unix can be used to restart PLTDE where you left off (it will take a RETURN key after restart to re-display the main menu).
Reasons for suspending PLTDE include the desire to read mail, edit a data file, run a Fortran program to generate more data, etc, all without losing your sequencing of plots. This is especially useful on a 2400 baud serial line.
Only a limited class of data files can be imported to pltde.
The source code is available. Contact the author by email for distribution requirements.
115 JWB Math Dept
University of Utah
Salt Lake City, UT 84112
Tel: (801) 581-6638
email: keener@solitude.math.utah.edu
email: keener@math.utah.edu