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

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

improvment of links in idldoc outputs by modification of shell script and some pro files. add test for pro2href.sh. see 62

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