Using gnuplotfortran ...



So, now you are ready to use the library, eh ? Its quite simple really.

Installation


Assuming that you downloaded and installed fortranposix correctly, you need to do the following :

  • Edit the supplied Makefile if necessary (I am always on the lookout for people who test fortranposix and gnuplotfortran out with new compilers and on new platforms - so if you are porting the libraries to *BSD, HP-UX, VMS, Mac OSX Darwin, etc. let me know so that we can spread the joy :)).
  • Run make.
  • This will generate a shared library : libgnuplotfortran.so and a few .mod files.
  • Move the shared library to some place within your LD_LIBRARY_PATH. You may want to make it available to everyone, so place it in a system wide path.
  • Move the .mod files to some standard location on your system. You may want to make these available to everyone, so place them in a system wide path.
  • Read the file gnuplot_fortran95_interfaces.f90 to learn about the usage of each function and to obtain the interface.
  • <>Append the -lgnuplotfortran -lfortranposix options to your linker and three lines to the code where you want to use the library :    use datatypes, use gnuplot_module_data, use gnuplot_module
  • You may also need to specify an addition search path for library files (usually -L), depending upon your fortran compiler.


Done.

Linking to your program


Let us say you got through so far. Your greatly enhanced, Gnuplot-friendly program is written, and it is the moment of truth ... <clears his throat> maybe we should give the testbench a spin in case you have not already done so :

$ f95 (extraoptions) -o gnuplot_fortran95_testbench gnuplot_fortran95_testbench.f90 -lfortranposix -lgnuplotfortran

$ ./gnuplot_fortran95_testbench

If things worked out well (in other words, Waheguru is smiling on you today), the above should start off a series of semi-interactive plot directives and leave a hardcopy of one of the plots in the working directory.

<clears his throat again>

Now you are ready to wade deep into the world where a gnuplot sky meets the Fortran95 ocean. Bon voyage ...