!______________________________________________________________________________ ! This program demonstrates how to use the Graphics module to plot 3D curves ! It plots the function z=sin(x)sin(y) both as a 3D color plot and ! also plots the colored contour lines of this function !______________________________________________________________________________ ! This module contains the function that we want to plot, in this case z=sin(x)sin(y) MODULE Sinx_Siny IMPLICIT NONE PUBLIC INTEGER, PARAMETER :: wp=KIND(0.0E0) ! All variables that are plotted must be single precision! REAL(KIND=wp) :: pi=3.141592654 CONTAINS FUNCTION z_xy(x,y) RESULT(z) REAL(KIND=wp), INTENT(IN) :: x,y REAL(KIND=wp) :: z z=SIN(x)*SIN(y) END FUNCTION z_xy END MODULE Sinx_Siny ! The main program: PROGRAM DISLIN_test USE SimpleGraphics USE FunGraphics USE Sinx_Siny IMPLICIT NONE CHARACTER(LEN=100), DIMENSION(2) :: title title(1)="Example of 3D surface plot of the function z=sin(x) sin(y)" title(2)="A. Donev, 10/8/00" ! First we plot this as a colored 3D surface (default for FunPlot3D) ! In this case we do not specify axis and use the default: CALL InitGraphics(file="TestFun_3Dsurf.png",file_type="CONS", & plot_title=title, & x_label="x",y_label="y",z_label="z") CALL FunPlot3D(f_xy=z_xy,xy_range=(/-pi,pi,-pi,pi/),num_points=(/20,20/)) CALL EndGraphics() ! Now we plot the same function with 20 colored contour lines ! in the range [-1,1] ! If in doubt, use the default values for all the optional arguments, as here: CALL InitGraphics(file="TestFun_2Dcontour.png",file_type="CONS", & plot_title=title, & x_label="x",y_label="y",z_label="z") CALL FunPlotContour(f_xy=z_xy,xyz_range=(/-pi,pi,-pi,pi,-1.0,1.0/),num_points=(/20,20,20/)) CALL EndGraphics() END PROGRAM DISLIN_test