# Rcjp's Weblog

## November 28, 1994

### Graphics and Plotting during my Ph.D

Filed under: physics — rcjp @ 11:45 am

It seems like a considerable chunk of my time during my PhD was devoted to getting half decent graphics output. When I started everyone was using NAG which was fast but very basic. I got handed a three folders full of GINO manuals and asked to write something that would plot in colour on the new HP Deskjet printers.

I remember being very fed up that the department had paid several hundred pounds for a graphics library that, although it contained routines for fitting curves to datapoints, wouldn’t scale the graph axes to cope with that – you had to do that yourself!

``````
CCCC  ===================================================================
CCCC  Converts the output from GINO type plot files for GNUPLOT to use
CCCC  ===================================================================
CCCC  -------------------------------------------------------------------
CCCC  Usage GCON "infile" "outfile"
CCCC  Version 1.0
CCCC  Created 28/11/94[1.0]
CCCC  -------------------------------------------------------------------
PROGRAM Convert
PARAMETER (mdim = 150)
DOUBLE COMPLEX pcmplx(mdim, mdim)
REAL pcoor(mdim, mdim)
CHARACTER*50 buf
CHARACTER*50  title
CHARACTER*1   choice
INTEGER*4     count
INTEGER*2     stat, i

count = NARGS()
IF (count .NE. 3) THEN
PRINT *, 'SYNTAX: GCON infile outfile '
STOP
END IF
CALL GETARG(1, buf, stat)
OPEN (10, file = buf(1:stat), STATUS='OLD')
CALL GETARG(2, buf, stat)
OPEN (11, file = buf(1:stat))

do j=1,mdim
enddo
print *,'****array out of bounds, increase mdim****'
stop

10   CONTINUE
ny = j - 1
PRINT *,' Real (R), Imaginary (I), Absolute Squared (A) ?'

IF (choice.eq.'R' .OR. choice.eq.'r') THEN
DO i = 1, nx
DO j = 1, ny
pcoor(i,j) = REAL(pcmplx(i,j))
END DO
END DO
ELSEIF (choice.eq.'I' .OR. choice.eq.'i') THEN
DO i = 1, nx
DO j = 1, ny
pcoor(i,j) = AIMAG(pcmplx(i,j))
END DO
END DO
ELSEIF (choice.eq.'A' .OR. choice.eq.'a') THEN
DO i = 1, nx
DO j = 1, ny
pcoor(i,j) = CABS(pcmplx(i,j))**2
END DO
END DO
ENDIF

xinc = (xmax - xmin) / nx
DO j = 1, ny
DO i = 1, nx
WRITE(11,20) xmin + xinc*(i-1), ymin+(j-1)*yinc, pcoor(i,j)
cccc  WRITE(6,20) xmin + xinc*(i-1), ymin+(j-1)*yinc, pcoor(i,j)
END DO
WRITE (11,'(A)')
END DO
20   FORMAT (1x, 3(E12.6,1x))

CLOSE(10)
CLOSE(11)
END
``````