home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / idlpvwa / 568 < prev    next >
Encoding:
Text File  |  1992-12-22  |  3.7 KB  |  118 lines

  1. Newsgroups: comp.lang.idl-pvwave
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!ames!nsisrv!stars.gsfc.nasa.gov!thompson
  3. From: thompson@stars.gsfc.nasa.gov (William Thompson, code 682.1, x2040)
  4. Subject: Re: contours
  5. Message-ID: <22DEC199210420355@stars.gsfc.nasa.gov>
  6. News-Software: VAX/VMS VNEWS 1.4-b1  
  7. Sender: usenet@nsisrv.gsfc.nasa.gov (Usenet)
  8. Nntp-Posting-Host: stars.gsfc.nasa.gov
  9. Organization: NASA/GSFC-Laboratory for Astronomy and Solar Physics
  10. References: <92357.132555ROMERO@EVALUN11.BITNET>
  11. Date: Tue, 22 Dec 1992 14:42:00 GMT
  12. Lines: 104
  13.  
  14. In article <92357.132555ROMERO@EVALUN11.BITNET>, Jose Vicente Romero Bauset <ROMERO@EVALUN11.BITNET> writes...
  15. >I am an IDL novice user. My question is:
  16. >Is there any possibility (I am sure there is) of drawing more
  17. >than 30 levels using the CONTOUR command?
  18. >Thanks in advance.
  19. >Jose Vicente Romero. University of Valencia.
  20. >P.S.
  21. >Jingle bells, jingle bells, la la la la la
  22. >Merry Christmas and Happy New Year 1993.
  23.  
  24. One way to do this would simply be to generate a contour plot with 30 levels,
  25. and then overplot another 30 levels, etc.  The following OCONTOUR routine
  26. should help.
  27.  
  28. Bill Thompson
  29.  
  30. P.S.  It would be nice if OCONTOUR was built-in to IDL, like OPLOT, etc.
  31.  
  32. ===============================================================================
  33.     PRO OCONTOUR,ARRAY,X,Y,LEVELS=LEVELS,COLOR=COLOR,MAX_VALUE=MAX_VALUE, $
  34.         C_LINESTYLE=C_LINESTYLE
  35. ;+
  36. ; NAME:
  37. ;    OCONTOUR
  38. ; PURPOSE:
  39. ;    This procedure draws contour plots over existing plots.
  40. ; CATEGORY:
  41. ; CALLING SEQUENCE:
  42. ;    OCONTOUR, ARRAY
  43. ;    OCONTOUR, ARRAY, X, Y
  44. ; INPUT PARAMETERS:
  45. ;    ARRAY    = Two dimensional array to make contour plot of.
  46. ; OPTIONAL INPUT PARAMETERS:
  47. ;    X, Y    = Vectors along X and Y axes.
  48. ; OPTIONAL KEYWORD PARAMETERS:
  49. ;    COLOR      = Color to use for drawing the contours.
  50. ;    LEVELS      = Levels to use for drawing the contours.
  51. ;    MAX_VALUE = Maximum value to use for drawing the contours.  Pixels with
  52. ;            values above MAX_VALUE will be ignored in drawing the
  53. ;            contours.
  54. ;    C_LINESTYLE = Line style to use for drawing the contours.
  55. ; COMMON BLOCKS:
  56. ;    None.
  57. ; SIDE EFFECTS:
  58. ;    None.
  59. ; RESTRICTIONS:
  60. ;    Array must be two-dimensional.  Dimensions of X and Y must match. 
  61. ; PROCEDURE:
  62. ;    The contour is done with XSTYLE=5, YSTYLE=5, XRANGE=!X.CRANGE,
  63. ;    YRANGE=!Y.CRANGE, and /NOERASE.
  64. ; MODIFICATION HISTORY:
  65. ;    William Thompson    Applied Research Corporation
  66. ;    May, 1988        8201 Corporate Drive
  67. ;                Landover, MD  20785
  68. ;
  69. ;    W.T.T., Mar 1991, modified for version 2.
  70. ;    W.T.T., Apr 1992, added LINESTYLE keyword.
  71. ;    W.T.T., Jun 1992, changed LINESTYLE to C_LINESTYLE.
  72. ;    William Thompson, December 1992, fixed problem with clipping region.
  73. ;-
  74. ;
  75.     ON_ERROR,2
  76. ;
  77. ;  Check the number of parameters.
  78. ;
  79.     IF (N_PARAMS() NE 1) AND (N_PARAMS() NE 3) THEN BEGIN
  80.         PRINT,'*** OCONTOUR must be called with 1 or 3 parameters:'
  81.         PRINT,'                    ARRAY, X, Y'
  82.         RETURN
  83.     ENDIF
  84. ;
  85. ;  Select the linestyle.
  86. ;
  87.     IF N_ELEMENTS(C_LINESTYLE) NE 1 THEN C_LINESTYLE = !P.LINESTYLE
  88. ;
  89. ;  Get the current clip region.
  90. ;
  91.     XCLIP = [!P.CLIP(0),!P.CLIP(2)]
  92.     YCLIP = [!P.CLIP(1),!P.CLIP(3)]
  93.     CLIP = CONVERT_COORD(XCLIP,YCLIP,/DEVICE,/TO_DATA)
  94.     CLIP = CLIP(0:1,*)
  95.     CLIP = CLIP(*)
  96. ;
  97. ;  Format the command needed to overplot the contour on the existing plot.
  98. ;
  99.     COMMAND = "CONTOUR,ARRAY,XSTYLE=5,YSTYLE=5,XRANGE=!X.CRANGE,"    + $
  100.         "YRANGE=!Y.CRANGE,/NOERASE,TITLE='',CLIP=CLIP,"        + $
  101.         "C_LINESTYLE=C_LINESTYLE"
  102. ;
  103. ;  Add any optional parameters or keywords.
  104. ;
  105.     IF N_PARAMS() EQ 3 THEN COMMAND = COMMAND + ",X,Y"
  106.     IF N_ELEMENTS(COLOR)  NE 0 THEN COMMAND = COMMAND + ",COLOR=COLOR"
  107.     IF N_ELEMENTS(LEVELS) NE 0 THEN COMMAND = COMMAND + ",LEVELS=LEVELS"
  108.     IF N_ELEMENTS(MAX_VALUE) NE 0 THEN    $
  109.         COMMAND = COMMAND + ",MAX_VALUE=MAX_VALUE"
  110. ;
  111. ;  Execute the command.
  112. ;
  113.     TEST = EXECUTE(COMMAND)
  114. ;
  115.     RETURN
  116.     END
  117.  
  118.