Since Fortran is primarily a scientific programming language, it is useful to have scientific data plotting tools available to draw into a gtk window created by gtk-fortran. The plplot library can potentially provide that functionality as it has a Fortran95 binding and also support for drawing to external cairo surfaces.
For this reason the necessary tools for integrating plplot with gtk-fortran are distributed as part of the gtk-fortran tree.
In the following it will be assumed that the
cmake-based build system is being used.
For most Linux distributions, plplot is distributed as a number of packages (the precise division depends on the distribution) however for most distributions if the
-devel package and the cairo drivers are selected the other required packages will be installed as well.
cmake scripts for gtk-fortran include a search for plplot's libraries and Fortran module files. If these are found, then the interface module and the examples will be build (Unless you explicitly prevent it by adding the
-D EXCLUDE_PLPLOT=Y option to
The examples and module have mainly been tested using plplot version 5.9.9, but it is possible to get them to work with 5.9.7 by uncommenting the commented-out definitions in
plplot_extra.f90. Version 5.9.5 (which is the version in Ubuntu 11.10) lacks a number of features needed to use the external cairo driver effectively.
Correctly configuring plplot's external cairo driver requires the use of the low-level
pl_cmd routine to connect the cairo context to the driver. This routine is not available to the Fortran95 binding of plplot (at least in part because it requires Fortran 2003's c-binding capabilities, and also until gtk-fortran no-one had used cairo surfaces and contexts explicitly from Fortran).
plplot_extra provides an interface to the
pl_cmd routine and also mnemonic definitions of the command codes.
Four examples from the plplot examples page have been adapted to work within gtk-fortran, these are, included in the
plplot subdirectory of gtk-fortran.