test02 Subroutine

public subroutine test02()

TEST02 demonstrates the plotting of a table of data.

Arguments

None

Calls

proc~~test02~~CallsGraph proc~test02 test02 proc~run_gnuplot run_gnuplot proc~test02->proc~run_gnuplot proc~write_xyy_data write_xyy_data proc~test02->proc~write_xyy_data proc~write_xyy_plots write_xyy_plots proc~test02->proc~write_xyy_plots proc~get_unit get_unit proc~write_xyy_data->proc~get_unit proc~write_xyy_plots->proc~get_unit

Called by

proc~~test02~~CalledByGraph proc~test02 test02 program~test_gnufor test_gnufor program~test_gnufor->proc~test02

Source Code

subroutine test02
!
!*******************************************************************************
!
!! TEST02 demonstrates the plotting of a table of data.
!
  implicit none
!
  integer, parameter :: nrow = 101
  integer, parameter :: ncol = 4
!
  integer, parameter :: lda = nrow
!
  real angle
  real area
  character ( len = 100 ) :: command_file_name = 'tmp/test02_commands.txt'
  character ( len = 100 ) :: data_file_name = 'tmp/test02_data.txt'
  character ( len = 100 ), dimension(1:ncol) :: title
  real height
  integer i
  integer ierror
  real, parameter :: r = 50.0E+00
  real width
  real x(lda,ncol)
!
  write ( *, '(a)' ) ' '
  write ( *, '(a)' ) 'TEST02'
  write ( *, '(a)' ) '  To plot X versus multiple sets of Y data,'
  write ( *, '(a)' ) '  WRITE_XYY_DATA writes the data file,'
  write ( *, '(a)' ) '  WRITE_XYY_PLOT writes the plot command file.'

  do i = 1, nrow

    height = 2.0E+00 * r * real ( i - 1 ) / real ( nrow - 1 )
    width = 2.0E+00 * sqrt ( r**2 - ( r - height )**2 )
    angle = acos ( ( r - height ) / r )
    area = 0.5E+00 * r**2 * 2.0E+00 * acos ( ( r - height ) / r ) &
      - ( r - height ) * sqrt ( height * ( 2.0E+00 * r - height ) )

    x(i,1) = height
    x(i,2) = width
    x(i,3) = angle
    x(i,4) = area

  end do

  title(1) = 'height'
  title(2) = 'width'
  title(3) = 'angle'
  title(4) = 'area'

  call write_xyy_data ( data_file_name, lda, nrow, ncol, x, ierror )

  if ( ierror /= 0 ) then
    write ( *, '(a)' ) ' '
    write ( *, '(a)' ) 'TEST02'
    write ( *, '(a,i6)' ) '  WRITE_XYY_DATA returned IERROR = ', ierror
  end if

  call write_xyy_plots ( command_file_name=command_file_name, data_file_name=data_file_name, title=title, ncol=ncol, &
    ierror=ierror )

  if ( ierror /= 0 ) then
    write ( *, '(a)' ) ' '
    write ( *, '(a)' ) 'TEST02'
    write ( *, '(a,i6)' ) '  WRITE_XYY_PLOTS returned IERROR = ', ierror
  end if

  call run_gnuplot ( command_file_name )

  return
endsubroutine test02