      SUBROUTINE PLOTPARS
C---------------------------------------------------------------------
C CALCULATE THE RA, DEC COORDINATES OF THE POINTS AND OF THE 
C ENDPOINTS OF THE ERROR BARS
C---------------------------------------------------------------------

      IMPLICIT UNDEFINED (A-Z)
      INCLUDE 'PARAMETR.INC'
      INCLUDE 'ELLIPSE.INC'   ! Variable declarations, common blocks

      INTEGER*2  I, J

D     WRITE(PR,*) ' PLOTPARS:  NPTS = ',NPTS

      RAMIN  = 0.
      RAMAX  = 0.
      DECMIN = 0.
      DECMAX = 0.
      DO I = 1, NPTS
          RA(I)        = ROBS(I)*SIN(THETAOBS(I))
          DEC(I)       = ROBS(I)*COS(THETAOBS(I))
C             FIND DATA MAXIMA AND MINIMA
          IF (RA(I).GT.RAMAX)   RAMAX =  RA(I)      
          IF (RA(I).LT.RAMIN)   RAMIN =  RA(I)      
          IF (DEC(I).GT.DECMAX) DECMAX = DEC(I)
          IF (DEC(I).LT.DECMIN) DECMIN = DEC(I)
C             SET ENDPOINTS OF ERROR BARS FOR RADIAL COORDINATE
          RADRA(1,I)   = RA(I)  + DRA(I)*SIN(PHI_ERR(I))
          RADRA(2,I)   = RA(I)  - DRA(I)*SIN(PHI_ERR(I)) 
          DECDRA(1,I)  = DEC(I) + DRA(I)*COS(PHI_ERR(I)) 
          DECDRA(2,I)  = DEC(I) - DRA(I)*COS(PHI_ERR(I)) 
          RADDEC(1,I)  = RA(I)  - DDEC(I)*COS(PHI_ERR(I))  
          RADDEC(2,I)  = RA(I)  + DDEC(I)*COS(PHI_ERR(I))  
          DECDDEC(1,I) = DEC(I) + DDEC(I)*SIN(PHI_ERR(I)) 
          DECDDEC(2,I) = DEC(I) - DDEC(I)*SIN(PHI_ERR(I)) 
      END DO

C CALCULATE THE DISPLAY MAXIMA AND MINIMA

      RALO  = RAMIN - 0.1*(RAMAX-RAMIN)
      RAHI  = RAMAX + 0.1*(RAMAX-RAMIN)
      DECLO = DECMIN - 0.1*(DECMAX-DECMIN)
      DECHI = DECMAX + 0.1*(DECMAX-DECMIN)

C      WRITE(PR,'(1X,A,4(F7.2,1X))')
C     1  'PLOTPARS: RALO,RAHI,DECLO,DECHI= ',RALO,RAHI,DECLO,DECHI

C SET THE TITLES

      TITLE(1) = 'APPARENT ORBIT OF '//STARNAME
      TITLE(2) = 'R.A. SEPARATION (mas)'
      TITLE(3) = 'DEC. SEPARATION (mas)'

      RETURN
      END

