|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - downloadIndex: ┃ R T ┃
Length: 6129 (0x17f1) Types: TextFile Names: »README«
└─⟦a0efdde77⟧ Bits:30001252 EUUGD11 Tape, 1987 Spring Conference Helsinki └─ ⟦this⟧ »EUUGD11/euug-87hel/sec1/graph/README«
A Graph Plot Program: I have found this program extremely useful for generating line plots from tables of data. It provides quite powerful operators to maniuplate and join different tables of numeric data. It does not do bar graphs, pie charts etc., although it could be modified to do so (and no, I am not volunteering!) It can also be used as a desk calculator or to print tables of results on the screen rather than as a graph. I personally prefer it to using dc and bc quite often (but then I am probably biased). Just type graph+ then 'print 1/log(3);' etc. I also use it interactively to check data files, find how many entries have a column with values in a certain range and so on. For example data = read "datafile" print count ( data where $1 > 0 && $1 < 10) The program here is not interactive like GNUPLOT but an alternative which provides greater flexability in the preparation of data before it is plot (I think). Since it can be used in a non-interactive fashion, it can be used in makefiles (I use Makefiles to keep documents which include graphs up to date). This program requires lex and yacc, and at present has calls to ctime() and getenv() (although these last two calls are not critical). It also requires the standard unix plot(3X) library. Output is in plot(5) format which must be fed through a filter program before it can be displayed. The maths library is used extensively to provide the same functions in graph+, but the actual code only really needs log() and pow(). I hope it is of some use to someone. At the end of this file are instructions for patching this program for your system. Brief History ============= After needing some graphs plotted and finding that the only really available command I could find was graph(1), I decided to write my own. I also found that awk was too slow for my liking when trying to extract data from lots of files to be reformatted in some way. Thus graph+ was born. Graph+ requires a program (much like a shell script) to drive it. It allows files of data to be loaded as two dimensional arrays and then allows many commands to manipulate the data. For example data = read "data.file" graph data where $1 > 0 [ $2 , $3 + $4 ] dotted line label "data" will plot a graph of the data in the file data.file but will only plot points where the first column in the file has values greater than zero, and the data to plot will be column 2 (x) vs the sum of the values in column 3 and 4 (y). When plotting the graph, different types of lines can be used (solid, dotted, dot dashed, short dashed, long dashed) or each point can be separately marked (with triangles, squares, circles, crosses). All the scaling and numbering of the axis is done automatically although most values can be over-ridden. The program also allows functions to be defined with sufficent power to do a least-squares best fit algorithm. The software was not written for efficency (it can be memory hungry as all the table operations tend to make copies when performing the operations) but I have not found memory to be a problem yet (well, not on our vax anyway!) All output is in standard plot(1) format as it uses the -lplot libraries. This software should be fairly portable across UNIX systems although a little work may be required for other systems (like IBM PCs). COMMON PROBLEMS =============== The automatic scaling mechanism still does not always work correctly. It is actually very difficult to do properly. If strange things appear to be happening, try specifiying from and to on the xaxis and yaxis statements (xaxis from 0 to 1000). Also, there can only be one xaxis and yaxis command per plot - multiple commands will ignore preceeding commands. Most of the automatic features can be overriden manually. Possible Patching Problems: o The file main.c contains a path name that needs to be patched. This is because the program looks in some special directories for predefined funtions (if you wish to install any). (See GLOB_LIB) The path can be defined in the Makefile instead. o The last function in main.c may also need to be re-written for your machine as it tries to determine what caused a floating exception. It will probably work without any alterations. It is patched for our VAX 11/750 running BSD 4.2 at the moment. o The file main.c uses getenv() and the file yacc.y uses time(), ctime() and system() (for the shell statement). o The include statement may not work as it involves fiddling with yacc. At present it chews one token more than I really want it to. o If your library does not contain relevant maths functions, either just delete the code, insert a dummy function, or whatever. Note that the code assumes all math functions have extern double func(); in <math.h> so if the function is not in the library, you will probably have to add your own extern's where necessary. o dumpgrph.c needs to know the width of a character!! This of course changes per output device. If the macro LASER is defined, it seems to work ok with our apple laser printer (helvetica), otherwise it works for a tektronics emulator on a Sun we have here. The size of a character must be known so that centering and right justification can be done (for titles, numbers along axis etc). o -lplot should be used in the Makefile for the most general form of the program. Output can then be fed into plot(1) which re-maps it for differnt terminal types. If however there is only one terminal you are ever going to use it on (eg: a Tektronics 4014) then there may be a plot library available on your machine so you can use -l4014 and not have to type graph+ ... | plot ... all the time. On the Sun for example there is a tektronics emulator which I use for previewing graphs (they NEVER come out quite right the first time). Alan Kent, Dept Computer Science, Royal Melbourne Institute of Technology, Melbourne, Australia. ACSNet: ajk@goanna.oz UUCP: {seismo,hplabs,mcvax,ukc,nttlab}!munnari!goanna.oz!ajk ARPA: munnari!goanna.oz!ajk@SEISMO.ARPA