ogpf is an object based Fortran 2003 / Fortran 2008 code implements an interface to gnuplot. A demo file, a brief tutorial and the latest version is available at: github.
Nine different color palettes are available. See Ann Schnider gnuplot color palettes and Gnuplotting. These color palettes can be used with:
surf(x,y,z,palette='plt-name')
contour(x,y,z,palette='plt-name')
There are a plenty commands to customise the plots. This includes:
The option command is a very powerful command and can be used to customize the gnuplot in many ways. Options can be set by calling the ogpf options. In every call, it is possible to set several options separated by semicolon or options can be set by several calls. Below shows few samples:
Set the legend (key) at the right bottom of window
call gp%options('set key bottom right')
Define a new line style
call gp%options('set style line 1 lc rgb "blue" lt 1 lw 2 pt 6 ps 1.5')
Use several options each uses separate command
call gp%options('set tics')
call gp%options('set tics font ",8"') ! font size for tics
Set several options at the same time using semicolon as delimiter
call gp%options('unset tics; unset colorbox')
There is a collection of examples in demo.f90 to show the capabilities of ogpf.
To use ogpf in your project, add the library file to your Fortran project (code) * ogpf.f90 (the main library)
For details see ‘demo.f90’
To use ogpf on other operating system, you may need to modify the terminal type and fonts in the section of Configuration Parameters. A Makefile has been provided to build the demo from command line.
This section shows selected example codes from demo.f90
SUBROUTINE Exmp01
!...............................................................................
!Example 1: A very basic example
!...............................................................................
TYPE(gpf):: gp
INTEGER, PARAMETER:: n=17
Real(wp):: x(n)
Real(wp):: y(n)
! Input data
x=dble([-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8])
y=dble([66,51,38,27,18,11,6,3,2,3,6,11,18,27,38,51,66])
! Annotation: set title, xlabel, ylabel
CALL gp%title('Example 1. A simple xy plot')
CALL gp%xlabel('my x axis ...')
CALL gp%ylabel('my y axis ...')
Call gp%options('set style data linespoints')
!Call Plot to draw a vector against a vector of data
CALL gp%plot(x, y)
END SUBROUTINE Exmp01
See results in github.