source: trunk/SRC/ToBeReviewed/PLOTS/DIVERS/placedessin.pro @ 237

Last change on this file since 237 was 237, checked in by pinsard, 17 years ago

replace some print by some report in some .pro (continuation) + improvements/corrections of some *.pro headers

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.9 KB
RevLine 
[2]1;+
2;
[226]3; @file_comments
[142]4; Putting into place of the drawing/ opening of the window or of the PS
[2]5;
[226]6; @categories
[142]7; Utilities
[2]8;
[163]9; @param TYPEDESSIN {type=string}
[237]10; It specify what procedure is called by <pro>PLACEDESSIN</pro> :
11; 'plt', 'pltz' or 'pltt'
[2]12;
[226]13; @keyword LANDSCAPE
[163]14; Force the page or the window on the screen to be in lengthened position.
[2]15;
[163]16; @keyword LCT {type=integer}
[226]17; It designate the number of the palette of color we want to use for the plot.
[2]18;       
[226]19; @keyword MAP
[142]20; We use it when we want to do a projection.
21; This keyword can be of two types:
[163]22;     MAP=[P0lat,P0lon,Rot]. For the description of these 3 values (see the online help of MAP_SET).
[226]23;     /MAP: In this case, map is automatically calculated have the value:
[142]24;          map = [0, (lon1+lon2)/2., 0]
[237]25; Comment 1: A good way to choose the type of the projection we want to do is to have a look at IDL demo:
[142]26; IDL> demo
27; Then choose earth sciences and  mapping.
[237]28; Comment 2: By default it is a cylindrical projection which is effectuated (with or without the keyword map).
[142]29; If we want an other projection, MAP must be activated and we have to add the keyword: /nom_projection.
30; For example, for a polar projection centered on the south pole:
31; IDL> domdef,-180,180,-90,-45
32; IDL> plt, tab, /stereo,map=[-90,0,0]
33;       
[226]34; @keyword NOCOLORBAR
[142]35; We active it if we do not want the colorbar.
36
[237]37; @keyword NOFILL
[142]38; We active it if we only want contours in black and white with a white background.
[2]39;
[226]40; @keyword NOERASE
[142]41; We active it to make a drawing without creating a new frame.
[2]42;
[226]43; @keyword SMALL
44; Vector composed of 3 or 4 elements, applied to make a drawing on a
[142]45; small portion of a page or screen. It delimit the zone where the drawing will be done.
46;     If there is 4 elements:
[226]47; then is constituted of coordinates (expressed in cm located from the up and
[237]48; left corner of the page or the window (in portrait like in landscape) of the bottom
[142]49; and left corner and of the up and right corner of the drawing zone.
50;     If there is 3 elements:
[226]51; in this case, we divide the page or the screen in small[0] columns and in small[1] lines
52; the drawing made in the box numbered small[2]. The numerotation starting up and left by
[142]53; the number 1 and then, following the writing direction.
[226]54; By default, we make the largest drawing we can do, conserving the aspect rapport
[163]55; (except when REMPLI is activated).
[226]56;
57; @keyword PORTRAIT
[142]58; Force the page or the window to be in standing position.
[2]59;
[226]60; @keyword POST
[142]61; Make a postscript. Only works if we made one drawing on the page.
[237]62; If we make several drawing, use \@<pro>ps</pro>.
[2]63;
[226]64; @keyword REMPLI
[142]65; Force the drawing to occupy the whole space defined by small.
[2]66;
[226]67; @keyword WINDOW
68; Number of the window on which we want to do the graph (Allow to open several windows).
[142]69; By default, we open 'IDL0'
[2]70;
[226]71; @keyword CB_TITLE
[142]72; The colorbar's title
[2]73;
[226]74; @keyword CONTOUR
75; If we want to trace contours of a different field than the one
76; whose we have the colored drawing (by example E-P in color and QSR in contours).
[237]77; It must be a field respecting same characteristics than the argument number
78; one of <pro>plt</pro>.
[2]79;
[226]80; @keyword ENDPOINTS
81; keyword specifying that we want to make a vertical cut in diagonal. Then coordinated of extremities
82; of these one are defined by the 4 elements of the vector ENDPOINTS: [x1,y1,x2,y2] which are
83; coordinates.
[142]84;
[163]85; @keyword VECTEUR {type=vector}
[142]86; It is a structure composed by 2 elements containing the 2 fields U
87; and V of values of the zonal and meridian component of the vector of the fields
88; to draw. These fields can be an array or a structure.
89;       For example: vecteur={matriceu:lec('unsurface'),matricev:lec('vnsurface')}
[163]90;       Comment: name of elements of vectors are inconsequential.
[142]91;       vecteur={u:lec('unsurface'),v:lec('vnsurface')} is also appropriated.
92;
93; @keyword DIREC
94; 't' 'x' 'y' 'z' 'xys' 'xz' 'yz' 'xyz' 'xt' 'yt' 'zt' 'xyt'
[226]95;       'xzt' 'yzt' 'xyzt' Direction on which do averages
[142]96;
97; @keyword _EXTRA
[231]98; Used to pass keywords
[142]99;
[226]100; @keyword COLOR_C
[142]101; To draw the contour in color instead of in black
[226]102; with filling in color
[142]103;
[163]104; @param POSFENETRE {out}{type=vector}
[226]105; It is a vector composed by 4 elements containing the position of the frame
106; containing captions and the graph in normalized coordinates.
107; Comment: To position the drawing; we have to do !p.position=posfenetre
[142]108; after the call of the caliber
109;
[163]110; @param POSBAR {out}{type=vector}
[226]111; Like POSFENETRE but for the color bar.
[142]112; Same comment to position the color bar, !p.position=posbar
113;
114; @uses
115; common.pro
116;
117; @history
[157]118; Sebastien Masson (smasson\@lodyc.jussieu.fr)
[2]119;                       26/4/1999
[142]120;
121; @version
122; $Id$
123;
[2]124;-
[231]125;
[37]126PRO placedessin, typedessin, posfenetre, posbar, BARMARGES = barmarges $
127                 , NOCOLORBAR = nocolorbar, NOFILL = nofill, COLOR_c = color_c $
128                 , CONTOUR = contour $
[2]129                 , VECTEUR = vecteur, PORTRAIT = portrait, LANDSCAPE = landscape $
[37]130                 , SMALL = small, MARGES = marges, MAP = map $
[2]131                 , REMPLI = REMPLI, POST = post, WINDOW = window $
[37]132                 , ENDPOINTS = endpoints, TYPE = type, BASICMARGES = basicmarges $
[232]133                 , NOERASE = noerase, LCT = lct, DIREC = direc, CB_TITLE = cb_title, _EXTRA = ex
[114]134;
135  compile_opt idl2, strictarrsubs
136;
[37]137@cm_4ps
138@cm_4mesh
139  IF NOT keyword_set(key_forgetold) THEN BEGIN
140@updatekwd
141  ENDIF
[2]142;-------------------------------------------------------------
[142]143; 1) Determination of the size of margins (unity=number of lines or columns)
144; to the left, to the right, up and down.
[226]145; BEWARE in margebar, the last element is the right up corner
[142]146; instead of the up margin
[2]147;-------------------------------------------------------------
[37]148  if n_elements(typedessin) EQ 0 then typedessin = 'autre'
149  if keyword_set(basicmarges) then begin
150    marge = 1.*[6, 2, 4, 3]
151    if keyword_set(marges) THEN marge = marge+marges
152    margebar = 1.*[marge[0]+1, marge[1]+1,  marge[2]-8,  marge[2]-6]
153    if keyword_set(barmarges) then margebar = margebar+barmarges
[226]154  ENDIF ELSE BEGIN
155    nocolorbar = keyword_set(nocolorbar) + keyword_set(nofill) + keyword_set(color_c)
[37]156    case typedessin of
157      'plt':marge = 1.*[6, 2, 4, 3]
158      'pltt':marge = 1.*[6+4*(type EQ 'xt'), 2, 4, 4]
159      'pltz':marge = 1.*[6, 2, 4, 3]
160      else:marge = 1.*[6, 2, 4, 3]
161    ENDCASE
162    if keyword_set(marges) THEN marge = marge+marges
163    if NOT keyword_set(barmarges) then barmarges = replicate(0, 4)
164    barmarges[3] = -barmarges[3]
165    margebar = 1.*[marge[0]+1, marge[1]+1, 2, 4]+barmarges
166    marge = marge+[0, 0, 4, 0]*keyword_set(cb_title)
167    IF keyword_set(direc) THEN $
168      marge = marge+[0, 0, 2, 0]*(strlowcase(direc) NE 't')
169    marge = marge+[0, 0, 2, 0]*keyword_set(contour)
170    marge = marge+[0, 0, 2, 0]*keyword_set(vecteur)
171    if n_elements(lon1) NE 0 and n_elements(lon2) NE 0 $
172      and n_elements(lat1) NE 0 and n_elements(lat2) NE 0 then begin
173      if keyword_set(type) then $
174        marge = marge+[0, 3*(type EQ 'yt' AND lon1 NE lon2), 0 $
175                       , 2*(type NE 'yt' AND lat1 NE lat2)]*keyword_set(endpoints) $
176      ELSE marge = marge+[0, 0, 0, 2*(lat1 NE lat2)]*keyword_set(endpoints)
177    endif
178    marge = marge+[0, 0, 2+margebar[3], 0]*(1-keyword_set(nocolorbar))
179  ENDELSE
[2]180;--------------------------------------------------------------
[142]181; Portrait or landscape
[2]182;--------------------------------------------------------------
[226]183  IF NOT keyword_set(noerase) THEN BEGIN
[69]184    CASE 1 OF
185      n_elements(portrait) NE 0:key_portrait = portrait
186      n_elements(landscape) NE 0:key_portrait = 1-landscape
187      ELSE:
188    ENDCASE
[226]189  ENDIF
[2]190;--------------------------------------------------------------
[142]191; What type of aspect rapport (it will be crushed if YXASPECT exist)
[2]192;--------------------------------------------------------------
[37]193  case typedessin of
194    'plt':yaspect = 1.*(lat2-lat1)/(lon2-lon1)
195    'pltt':yaspect = 1.
196    'pltz':yaspect = .5
197    ELSE:yaspect = 1.
198  endcase
[2]199;-------------------------------------------------------------
[142]200; 2) calculation of !p.position
201; see calibre.pro.
[2]202;------------------------------------------------------------
203;
[37]204  IF NOT keyword_set(small) then small = [1, 1, 1]
[2]205;
[37]206  if keyword_set(map) then rempli = 1
[2]207;
[37]208  calibre, yaspect, marge, margebar, small, posfenetre, posbar, REMPLI = rempli, _extra = ex
[2]209;
[37]210  !p.position = posfenetre
[2]211;------------------------------------------------------------
[142]212; 3) opening of the graphic window or of the postscript
[2]213;------------------------------------------------------------
[37]214  case 1 of
[226]215; case of the first drawing on a postscript
[37]216    keyword_set(post) AND !d.name ne 'PS':openps, _extra = ex
[142]217; case of the first drawing on a screen
[37]218    keyword_set(post) EQ 0 AND keyword_set(noerase) EQ 0 $
219      AND !d.name ne 'PS' AND !d.name ne 'Z':BEGIN
220      if not keyword_set(window) then window = 0
[142]221; For the using of \@ps,\@oups et de \@vzoom
222      if lmgr(/demo) EQ 0 then BEGIN ; Are we in the demo mode??
[237]223        if !journal NE 0 then journal ; We close the journal if it is open
[37]224        homedir = isadirectory(io = homedir, title = 'Bad definition of homedir')
225        def_myuniquetmpdir
[142]226        journal, myuniquetmpdir+'idlsave.pro' ; We open a new one
227        help, /recall_commands, output = listecommande ; We recuperate the last command
[37]228        listecommande = strmid(strcompress(listecommande[1]), 2)
[142]229        journal, listecommande ; We write it in the journal
[37]230      ENDIF
231      windsize = givewindowsize()
232      window, window, xsize = windsize[0], ysize = windsize[1],  retain = 2, _extra = ex
[226]233; When we used colors which are coded on 24bit, we can not stipulate the background color
[142]234; of a window thanks to !p.background, so we have to to this:
[2]235;          if !d.n_colors gt 256 then begin
236;             device, decomposed=1
237;             !p.background='ffffff'x
238;             plot,[0],[0], /nodata, xstyle = 4, ystyle = 4
239;             device, decomposed=0
240;          endif
[37]241    END
242    ELSE:
243  endcase
[2]244;------------------------------------------------------------
[37]245  if n_elements(lct) NE 0 then lct, lct, _extra = ex
[2]246;------------------------------------------------------------
247
[37]248  return
[2]249end
Note: See TracBrowser for help on using the repository browser.