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

Last change on this file since 367 was 367, checked in by pinsard, 16 years ago

typo and translation

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