1
Fortran 95 bindings for PLplot
2
------------------------------
8
The Fortran 95 bindings for PLplot have been set up with the following
9
considerations in mind:
10
- reuse the bindings for FORTRAN 77 if possible
11
- provide alternative calls for the various routines to take advantage
12
of the features of Fortran 95, most notably, to simplify the interface
13
- provide a module that takes care of all the details
15
Fortran 90 versus Fortran 95
16
----------------------------
17
Because the Fortran 95 standard is supported by most if not all current
18
Fortran compilers, it seemed logical to target this standard, rather
19
than Fortran 90. The differences are small enough though not to matter
22
To stress that Fortran 95 is the target, we use .f95 as the extension
23
for the examples. Note that the extension is not important for
24
most compilers: it merely indicates that the freeform source format is
29
The PLplot module defines:
30
- Several parameters for use with the PLplot library
31
- Interfaces for all the routines that can be used with Fortran 95
33
- Several alternative interfaces for various routines
36
- PLFLT or PLF for short
37
This is the KIND parameter for all floating-point variables and values
38
used by the PLplot library. See the example below for its use
41
A parameter used in the call to PLPARSEOPTS
44
The approximation of the number "pi". It is used in many examples
45
and because it is often defined in other modules as well, we have
46
given it a more specific name.
47
Should you prefer "PI" (or "pi") then use the module like this:
50
use plplot, pi => pl_pi
53
- PL_GRID_CSA, PL_GRID_DTLI, PL_GRID_NNI, PL_GRID_NNIDW, PL_GRID_NNLI,
55
Parameters that select the gridding algorithm for PLGRIDDATA
57
- PL_JUST_NONE, PL_JUST_OPTIMAL, PL_JUST_SAME, PL_JUST_ISOMETRIC:
58
The justification of axes in PLENV. The names should be more or
59
less self-explanatory.
61
- PL_AXIS_NOTHING - no decoration for the axis
62
PL_AXIS_BOX_ONLY - only the axles
63
PL_AXIS_NORMAL = ordinary axes
64
PL_AXIS_ATZERO = include lines through 0-coordinates
65
PL_AXIS_MAJORGRID = include grid for major tickmarks
66
PL_AXIS_MINORGRID = include grid for major and minor tickmarks
67
PL_AXIS_LOGX = use logarithmic X axis
68
PL_AXIS_LOGY = use logarithmic Y axis
69
PL_AXIS_LOGXY = both axes logarithmic
71
You can combine the logarithmic options with the others
72
(except PL_AXIS_NOTHING and PL_AXIS_BOX_ONLY) by simply
73
adding them: PL_AXIS_LOGX+AXIS_MAJORGRID for instance
75
To illustrate the alternative interfaces for various routines,
76
here are the possibilities to call PLBIN
81
plbin(PLINT nbin, PLFLT *x, PLFLT *y, PLINT center);
83
Because in Fortran 95, the size of the array can be queried via the SIZE
84
intrinsic function, we can drop the nbin argument. And while C has no
85
specific logical data type, Fortran has. So there are four ways to call
86
PLBIN from Fortran 95:
89
integer :: icenter, nbin
90
real(kind=plflt), dimension(:) :: x, y
93
! Fortran 95, method 1 (compatible with FORTRAN 77)
97
call plbin( nbin, x, y, icenter )
100
! Fortran 95, method 2
103
call plbin( x, y, center ) ! Drop the argument nbin, use a logical for center
106
! Fortran 95, method 3
109
call plbin( x, y, icenter ) ! No nbin, use an integer for center
112
! Fortran 95, method 4
115
call plbin( nbin, x, y, center ) ! Use nbin, use a logical for center
117
Method 2 is preferred, as it is most "Fortran 95" in character.