C------------------------------------------------------------
C  MULCDR_ELVIS
C
C  DRAW MULTIPLE (R,Y) CONTOURS  - BASED ON MULFDR - DMC 9/84
C    do it in ELVIS
C
C  DRAW A MULTIPLOT WITH KEY.
C  CALLER SETS SCALE AND AXIS TYPE
C
C  DATA TO BE PLOTTED IS PASSED IN 2D ARRAYS
C
C  NO USER I/O OR CONTROL IS PROVIDED
c
c  dmc Aug 2004 -- arguments as in MULCDR except IAXSEL is omitted...
c
      SUBROUTINE MULCDR_ELVIS(
     >   R,Y,ND1,NC,NNC,Z,NZ,ISELF,NSEL,
     >   RUN,YUN,MNLAB,KYLAB,LBSEL)
C
C  ARGUMENTS -- ALL MUST BE SUPPLIED BY CALLER (OUTPUT IS GRAPH)
C
C  IN COMMON/DPLOT1/  XMIN,XMAX,YMIN,YMAX -- THE SCALE OF THE GRAPH
C
C  PASSED:
C
C   R(ND1,NZ)  DATA BUFFER OF INDICATED DIMENSIONS-- HORIZONTAL CONTOUR
C              PARAMETRIZATION
C   Y(ND1,NZ)  DATA BUFFER OF INDICATED DIMENSIONS-- VERTICAL CONTOUR
C              PARAMETRIZATION
C
C     the i'th point in the j'th contour is at (R(i,j),Y(i,j))
C
C  **NC** IS THE ACTUAL NUMBER OF PTS IN EACH CONTOUR (.LE.ND1)
C   NC(NNC) -- NC(1) IS THE NO. OF PTS IN THE 1ST CONTOUR ...
C              NC(MIN(NZ,NNC)) IS THE NO. OF PTS IN THE NZ'TH CONTOUR
C              NOTE THAT BY PASSING NNC=1 ONE MAY SPECIFY THE SAME
C              NO. OF POINTS IN ALL CONTOURS, OR BY SETTING NNC=NZ
C              AND FILLING THE NC INTEGER ARRAY ONE MAY HAVE A DIFFERENT
C              NO. OF POINTS FOR EACH CONTOUR.  HOWEVER,
C                  2 .LE. NC(J) .LE. ND1
C              MUST BE MAINTAINED FOR ALL J BTW 1 AND MIN(NZ,NNC)
C
C   Z(NZ)      CONTOUR INDEXING
C
C   ISELF(NSEL) SELECTS WHICH CONTOURS ARE TO APPEAR
C     ON THE MULTIPLOT.
C   **NSEL** IS THE NUMBER OF CURVES TO APPEAR ON THE MULTIPLOT
C     the contours that appear correspond to
C       Z(iself(1)), Z(iself(2)), ..., Z(iself(NSEL)).
C
C   -----------
C   CHARACTER LABELS:
C   ------------
C    RUN        10 CHAR HORIZONTAL AXIS PHYSICAL UNITS LABEL
C    YUN        10 CHAR VERTICAL AXIS PHYSICAL UNITS LABEL
C
C   MNLAB       3 60 CHARACTER "MAIN LABELS"-- 1ST TWO APPEAR
C               ABOVE GRAPH, LAST ONE BELOW
C   KYLAB       5 17 CHARACTER KEY LABELS -- 1ST TWO APPEAR
C               AT TOP OF KEY BOX, LAST THREE AT BOTTOM
C   LBSEL(NSEL) NSEL 10 CHARACTER SELECT LABELS-- 10 CHARACTERS
C               TO ID EACH CURVE IN THE MULTIPLOT (1,2,... NSEL)
C
C *NOTE LABELS DO *NOT* NEED TO BE TERMINATED WITH "$", BUT A "$" IN
C  THE LABEL WILL CHOP OFF OUTPUT OF THE LABEL AT THAT POINT***
C
      implicit NONE
C
c  passed
c
      integer ND1,NZ,NSEL,NNC
      REAL R(ND1,NZ),Y(ND1,NZ),Z(NZ)
      INTEGER ISELF(NSEL)
      INTEGER NC(NNC)
      CHARACTER*(*) MNLAB(3)
      CHARACTER*(*) KYLAB(5)
      CHARACTER*(*) LBSEL(NSEL),RUN,YUN
C
c  local
c
      character*64 wname
      character*40 gname
      integer i,j,inc,iwarn
C
C--------------------------------------------------------
C  window name
      call trgraf_wname_get(wname)
C  gen graph name
      call trgraf_gname_get(gname)
C  start data collection for ElVis display
      call trgraf_elvis_start(wname,gname)
C  label info
      call trgraf_elvis_labelxy(MNLAB(3),run,yun)
      call trgraf_elvis_addlabel(MNLAB(1),iwarn)
      call trgraf_elvis_addlabel(MNLAB(2),iwarn)
C
      do i=1,nsel
         j=abs(iself(i))
         inc=nc(min(j,nnc))
         call trgraf_elvis_xyadd(r(1:inc,j),y(1:inc,j),inc,1,
     >        lbsel(i))
      enddo
C
C  transfer key labels
C
      do i=1,5
         call trgraf_elvis_addkylab(kylab(i),iwarn)
      enddo
c
c  now make ELVIS plot
c
      call mulfdraw_elvis       ! shared with mulfdr_elvis this subroutine
c
      return
      end
