
N = 25 ! number of grid points in x directionĬall meshgrid(x, y, xgrid, ygrid) ! generate the 2D grid dataĬall gp%title( 'Example 101: Simple 3D plot ') M = 55 ! number of grid points in y direction Scatter plot: data with noise ')Ĭall gp%plot(x,y, 'w l lc "blue" ', x, ym, 'w l lc "dark-red" lw 2 ') ! plot only the experimental data call gp%title( 'Example 20. X, ym, 't "mode: y=sqrt(x)" w lines lt 1 lw 3 lc "blue" ') Scatter plot ')Ĭall gp%options( 'set style line 1 lc rgb "blue" lt 1 lw 2 pt 6 ps 1.5 ')Ĭall gp%plot(x, y, 't "exp data" with points pt 6 ps 1.2 lc rgb "#ad2060" ', &

generate the measured data with noise (ensembles the experimental data)Ĭall random_number(noise) ! generate noise in ĭ = (b -a) / 100.0_wp * (x -a) ** 2 ! define the deviation functionĭ = 2.0_wp *(noise - 0.5_wp) * d ! distribute noise around y = 0Ĭall gp%title( 'Example 20. Use add_script and run_script to do versatile operation with gnuplot Print *, 'Plot commands were written in Example16.gp successfully ' print *, 'Open gnuplot and load this script file to plot the results! ' print * ! empty line Save the script into file for future use ")Ĭall gp%plot(x, y, ls1 = 'with lp ls 1 ', x2 =x, y2 =z, ls2 = 'with lp ls 2 ') Integer, parameter :: n = 100 real(wp) :: x(n)Ĭall gp%options( 'set border linewidth 1.5 ')Ĭall gp%options( 'set style line 1 lc rgb "#ad6009" lt 1 lw 2 pt 7 ps 1.5 # - red like ')Ĭall gp%options( 'set style line 2 lc rgb "#00ad09" lt 2 lw 2 pt 6 ps 1.5 # - green like ')Ĭall gp%title( "Example 16. ! this is a multipart string spanned over several linesĬall mp%options( '& &set style data linespoints & &set xrange & &set yrange & &set autoscale ')Ĭall mp%options( 'set key top left ') ! set the key locationĬall mp%plot(x1 =x, y1 = 1.50 *y, ls1 = 't "y=1.5x^2" ls 1 ', & !Options is a dynamic length string and can set all kind of gnuplotĬall mp%options( 'set style line 1 lc rgb "#0060ad" lt 1 lw 2 pt 5 ps 1.5 # - blue ')Ĭall mp%options( 'set style line 2 lc rgb "#ad6000" lt 2 lw 2 pt 6 ps 1.5 # - red ')Ĭall mp%options( 'set style line 3 lc rgb "#00ad00" lt 2 lw 2 pt 7 ps 1.5 # - green ') X,yc, 'title "cos" with points lt 6 lc rgb "#FF1100" ', & ! Plot to draw three set of data CALL gplot%plot(x,ys, 'title "sin" with lines lt 5 lc rgb "#0008B0" ', & X =linspace( - 2.d0 *pi, 2.d0 *pi,n) !linspace is a utility function from module UtilsĬALL gplot%title( 'Example 5. INTEGER, PARAMETER :: n = 50 Real(wp) :: x(n) This section shows selected example codes from demo.f90 In the section of Configuration Parameters.Ī Makefile has been provided to build the demo from command line.

To use ogpf on other operating system, you may need to modify the terminal type and fonts To use ogpf in your project, add the library file to your fortran project (code)įor details see 'demo.f90' Important Note There is a collection of examples in demo.f90 to show the capabilities of ogpf. Set several options at the same time using semicolon as delimiterĬall gp%options('unset tics unset colorbox') Demo Use several options each uses separate commandĬall gp%options('set tics font ",8"') ! font size for tics Set the legend (key) at the right bottom of windowĬall gp%options('set style line 1 lc rgb "blue" lt 1 lw 2 pt 6 ps 1.5') In every call, it is possible to set several options separated by semicolon or options can be set by several calls. Options can be set by calling the ogpf options. The option command is a very powerful command and can be used to customize the gnuplot in many ways. xrange, yrange, zrange, and grid)Ĭall gp%axis() ! Sets xrangeĬall gp%axis() ! Sets both xrange and yrangeĬall gp%axis() ! Sets all axis at same timeĬall gp%xlim() ! Sets only the xrangeĬall gp%ylim() ! Sets only the yrangeĬall gp%zlim() ! Sets only the zrange There are plenty of commands to customise the plots. See Ann Schnider gnuplot color palettes and Gnuplotting. Nine different color palettes are available. gnuplot 5 and higher (other previous version can be used)Įmail: mrahmaniautacir There is only two more features needs Fortran 2008 standardĮxecute_command_line and passing internal function as argument.Ģ. Fortran 2003 compiler (e.g gfortran 4.7, IVF 12.1, and later.
GNUPLOT 3D SURFACE MAC
(It should work on other platforms, e.g Mac see the finalize_plot subroutine in ogpf.f90) Purpose: Object Based Interface to GnuPlot from Fortran (ogpf)
