write_xy2_plot Subroutine

private subroutine write_xy2_plot(command_file_name, data_file_name, logscale, ierror, nom)

Arguments

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

Calls

proc~~write_xy2_plot~~CallsGraph proc~write_xy2_plot write_xy2_plot proc~get_unit get_unit proc~write_xy2_plot->proc~get_unit

Source Code

subroutine write_xy2_plot ( command_file_name, data_file_name, logscale, ierror, nom )
  implicit none
!
  character ( len = * ) command_file_name
  character ( len = * ) nom
  character ( len = * ) data_file_name
  integer file_unit
  !integer i
  integer ierror
  integer ios
  logical logscale
!
!  Write the data file.
!
  ierror = 0

  call get_unit ( file_unit )

  if ( file_unit == 0 ) then
    ierror = 1
    write ( *, '(a)' ) ' '
    write ( *, '(a)' ) 'WRITE_XY_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_XY_PLOT - Fatal error!'
    write ( *, '(a)' ) '  Could not open the output file.'
    return
  end if

  if (trim(nom)/='*') then
      write ( file_unit, '(a)' ) 'set term pngcairo'
      write ( file_unit, '(a)' ) 'set output "'//trim(nom)//'.png"'
  endif



  write ( file_unit, '(a)' ) 'set title "GNUFOR plot"'
  if (logscale) write ( file_unit, '(a)' ) 'set logscale x'
  write ( file_unit, '(a)' ) 'set xlabel "x"'
  write ( file_unit, '(a)' ) 'set ylabel "y"'
  write ( file_unit, '(a,i2,a)' ) 'plot "' // trim ( data_file_name ) // '" using 1:2 with lines,\'
  write ( file_unit, '(a,i2,a)' )       '"'// trim ( data_file_name ) // '" using 1:3 with lines '
  !write ( file_unit, '(a)' ) 'pause -1  "Hit return to continue"'
  write ( file_unit, '(a)' ) 'q'

  close ( unit = file_unit )

  return
endsubroutine write_xy2_plot