write_polar_plot Subroutine

private subroutine write_polar_plot(command_file_name, data_file_name, ierror)

Arguments

Type IntentOptional Attributes Name
character(len=*) :: command_file_name
character(len=*) :: data_file_name
integer :: ierror

Calls

proc~~write_polar_plot~~CallsGraph proc~write_polar_plot write_polar_plot proc~get_unit get_unit proc~write_polar_plot->proc~get_unit

Source Code

subroutine write_polar_plot ( command_file_name, data_file_name, ierror )
  implicit none
!
  character ( len = * ) command_file_name
  character ( len = * ) data_file_name
  integer file_unit
  integer ierror
  integer ios
!
!  Write the data file.
!
  ierror = 0

  call get_unit ( file_unit )

  if ( file_unit == 0 ) then
    ierror = 1
    write ( *, '(a)' ) ' '
    write ( *, '(a)' ) 'WRITE_POLAR_PLOT - Fatal error!'
    write ( *, '(a)' ) '  Could not get a free FORTRAN unit.'
    return
  end if

  open ( unit = file_unit, file = command_file_name, status = 'replace', &
    iostat = ios )

  if ( ios /= 0 ) then
    ierror = 2
    write ( *, '(a)' ) ' '
    write ( *, '(a)' ) 'WRITE_POLAR_PLOT - Fatal error!'
    write ( *, '(a)' ) '  Could not open the output file.'
    return
  end if

  write ( file_unit, '(a)' ) 'set title "GNUFOR plot"'
  write ( file_unit, '(a)' ) 'set angles degrees'
  write ( file_unit, '(a)' ) 'set polar'
  write ( file_unit, '(a)' ) 'set grid polar'
  write ( file_unit, '(a)' ) 'set xlabel "azimuth"'
  write ( file_unit, '(a)' ) 'set ylabel "r"'
  write ( file_unit, '(a,i2,a)' ) 'plot "' // trim ( data_file_name ) // &
    '" using 1:2 with lines'
  write ( file_unit, '(a)' ) 'pause -1  "Hit return to continue"'
  write ( file_unit, '(a)' ) 'q'

  close ( unit = file_unit )

  write ( *, '(a)' ) ' '
  write ( *, '(a)' ) 'WRITE_XY_PLOT:'
  write ( *, '(a)' ) '  Wrote the GNUPLOT XY plot command file "' // &
    trim ( command_file_name ) // '"'

  return
endsubroutine write_polar_plot