Re: Plotting more than one curve using EZXY?

From: Dave Kennison (kennison AT unknown)
Date: Thu Jun 28 2001 - 10:06:09 MDT

  • Next message: Orenthal J. Tucker: "ncarg with WRFV1"

    > I would like to plot an ellipse consisting of N points using EZXY. Then I would
    > like to draw a line along the semi-major axis using LINE specifying two points.
    > But EZXY advances to the next frame after drawing the ellipse. The docs mention
    > that the frame advance could be changed by SET in autograph_params. There is
    > so much information there that I could not find what I was looking for. If
    > someone has done this, could you please lend a hand? I would like to have the
    > ellipse and line in the same plot.

    The following program will do it:

          PROGRAM TESTIT
            PARAMETER (NPTS=1001,AVAL=2.567,BVAL=1.983,ROTA=16.)
            DIMENSION XCRA(NPTS),YCRA(NPTS)
            DATA DTOR / .017453292519943 /
            DO 101 I=1,NPTS
              ANGD=360.*(REAL(I-1)/REAL(NPTS-1))
              XTMP=AVAL*COS(DTOR*ANGD)
              YTMP=BVAL*SIN(DTOR*ANGD)
              XCRA(I)=XTMP*COS(DTOR*ROTA)-YTMP*SIN(DTOR*ROTA)
              YCRA(I)=XTMP*SIN(DTOR*ROTA)+YTMP*COS(DTOR*ROTA)
              IF (I.EQ.NPTS/3) THEN
                XCP1=XCRA(I)
                YCP1=YCRA(I)
              ELSE IF (I.EQ.2*NPTS/3) THEN
                XCP2=XCRA(I)
                YCP2=YCRA(I)
              END IF
      101 CONTINUE
            CALL OPNGKS
            CALL AGSETI ('FRAME.',2)
            CALL AGSETR ('GRID/SHAPE.',.25)
            CALL EZXY (XCRA,YCRA,NPTS,'ELLIPSE')
            CALL LINE (XCP1,YCP1,XCP2,YCP2)
            CALL FRAME
            CALL CLSGKS
            STOP
          END

    I have parameterized some things. NPTS is the number of points to be used
    to approximate the ellipse. AVAL and BVAL are the lengths of the semi-major
    and semi-minor axes. ROTA is an angle by which to rotate the ellipse. DTOR
    is for conversion from degrees to radians.

    The call setting 'FRAME.' to 2 turns off the frame advance. The call setting
    'GRID/SHAPE.' to .25 says to set the aspect ratio so that the X and Y axes
    have the same scale. The call to LINE draws a line connecting two points on
    the ellipse whose coordinates have been saved.

    Dave Kennison



    This archive was generated by hypermail 2b29 : Mon Jul 09 2001 - 12:15:24 MDT