In order to visualize results in the Versamedium examples the PGPLOT Graphics Subroutine Library by T. J. Pearson. Is required to be installed.
The PGPLOT libraries are known to work well under UNIX based systems. Instructions for run our demonstration programs under Windows NT (32-bit), or in a computer without OS, refer to the IN-WINDOWS-HOWTO.
Download the package: pgplot5.2.tar.gztar -zxvf pgplot5.2.tar.gz
The following instructions asume that you downloaded the pgplot5.2.tar.gz file in directory /tmp
Do as root (sudo su):
A)mkdir /usr/packages
cp /tmp/pgplot5.2.tar.gz /usr/packages
cd /usr/packages
tar -zxvf pgplot5.2.tar.gz
The above instruction will generate the /usr/packages/pgplot ``source'' directory.
B)Now we need to generate a target directory /usr/local/pgplot:
mkdir /usr/local/pgplot
go to target empty directory:
cd /usr/local/pgplot
Now we need copy the file drivers.list from source directory into empty target directory.
cp /usr/packages/pgplot/drivers.list .
Edit the file drivers.list with the ``type'' of output that you want your programs to generate (i.e. your fortran/C plots can be generated in Postscript, GIF, XWINDOW, etc.. - choose some options -) by removing the initial ! character at the begining of each driver.
Note: Use vi,nano,gedit,nedit, or emacs text editor.
vi drivers.list
I choose to have the following drivers uncommented (without the ! character)
GIDRIV 1 /GIF GIF-format file, landscape.........
NUDRIV 0 /NULL Null device (no output)............
PNDRIV 1 /PNG Portable Network Graphics file.....
PSDRIV 1 /PS PostScript printers, monochrom.....
XWDRIV 1 /XWINDOW Workstations running X Window......
Create the makefile
/usr/packages/pgplot/makemake /usr/packages/pgplot linux g77_gcc
Which should give you the following output:
For additional information, read file /usr/packages/pgplot/sys_linux/aaaread.me
Reading configuration file: /usr/packages/pgplot/sys_linux/g77_gcc.conf
Selecting uncommented drivers from ./drivers.list
Found drivers GIDRIV NUDRIV PNDRIV PSDRIV XWDRIV
Copying color database.
Creating make file: makefile
Determining object file dependencies.
Edit the makefile file and do the following changes:
vi makefile
----------------------------------------------------------------------------------------
Replace:
"FCOMPL=g77" *in line 25
by:
"FCOMPL=gfortran"
Replace:
"FFLAGC=-u -Wall -fPIC -O" *in line 26
by:
"FFLAGC=-ffixed-form -ffixed-line-length-none -u -Wall -fPIC -O"
Replace:
"pndriv.o : ./png.h ./pngconf.h ./zlib.h ./zconf.h" *in line 880
by:
"pndriv.o : "
----------------------------------------------------------------------------------------
make
for the C binding:
make cpg
Note:
PGPLOT documentation was created in /usr/local/pgplot/pgplot.doc (ascii text file)
cd /usr/local/lib
ln -s /usr/local/pgplot/libpgplot.a libpgplot.a
ln -s /usr/local/pgplot/libcpgplot.a libcpgplot.a
cp /usr/local/pgplot/libpgplot.so .
cp /usr/local/pgplot/libpgplot.so /usr/lib/
Edit /etc/ld.so.conf file and add the following line:
/usr/local/lib
Proceed as follows:
/sbin/ldconfig -v
ln -s /usr/local/pgplot/cpgplot.h /usr/local/include/cpgplot.h
vi /etc/profile
add the following lines to /etc/profile :
export PGPLOT_DIR=/usr/local/pgplot
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/pgplot:
To run some examples without reseting the machine do as follows:
ldconfig
source /etc/profile
./cpgdemo
root@movil-pc:/usr/local/pgplot# ./cpgdemo Graphics device/type (? to see list, default /NULL):(type in the prompt above either /xwindow , /gif , /png or /ps )
After pressing the return key (3 times) you should see the 3 examples compiled in C
For examples compiled in Fortran type:
./pgdemo1
./pgdemo2
.
.
Note: Source code for the fortran examples are in: /usr/packages/pgplot/examples pgdemo10.f pgdemo13.f pgdemo16.f pgdemo3.f pgdemo6.f pgdemo9.f pgdemo11.f pgdemo14.f pgdemo17.f pgdemo4.f pgdemo7.f pgdemo1.f pgdemo12.f pgdemo15.f pgdemo2.f pgdemo5.f pgdemo8.f
gcc -Wall -O2 -c -I/usr/local/pgplot pgplot_graph.c
then link the graphic libraries as follows:
gfortran -o pgplot_graph pgplot_graph.o -L/usr/local/pgplot/ -lcpgplot -lpgplot -lpng -lz -L/usr/X11R6/lib -lX11 -lm -lc

gfortran pgplot_graph.f -o pgplot_graph -L/usr/local/pgplot/
