[2] | 1 | ;------------------------------------------------------------ |
---|
| 2 | ;------------------------------------------------------------ |
---|
| 3 | ;------------------------------------------------------------ |
---|
| 4 | ;+ |
---|
| 5 | ; |
---|
[142] | 6 | ; @file_comments |
---|
| 7 | ; Putting into place of the drawing/ opening of the window or of the PS |
---|
[2] | 8 | ; |
---|
[142] | 9 | ; @categories |
---|
| 10 | ; Utilities |
---|
[2] | 11 | ; |
---|
[142] | 12 | ; @param TYPEDESSIN |
---|
| 13 | ; It is a chain or characteres specifying what procedure is called by PLACEDESSIN: 'plt', 'pltz' or 'pltt' |
---|
[2] | 14 | ; |
---|
[142] | 15 | ; @keyword LANDSCAPE |
---|
| 16 | ; Force the page or the window on the screen to be in lenthened position. |
---|
[2] | 17 | ; |
---|
[142] | 18 | ; @keyword LCT |
---|
| 19 | ; Is an integer designating the number of the palette of color we want to use for the plot. |
---|
[2] | 20 | ; |
---|
[142] | 21 | ; @keyword MAP |
---|
| 22 | ; We use it when we want to do a projection. |
---|
| 23 | ; This keyword can be of two types: |
---|
| 24 | ; MAP=[P0lat,P0lon,Rot]. For the descrption of these 3 values (see the online help of MAP_SET). |
---|
| 25 | ; /MAP: In this case, map is automatically caculated have the value: |
---|
| 26 | ; map = [0, (lon1+lon2)/2., 0] |
---|
| 27 | ; Comment: A good way to choose the type of the projection we want to do is to have a look at IDL demo: |
---|
| 28 | ; IDL> demo |
---|
| 29 | ; Then choose earth sciences and mapping. |
---|
| 30 | ; Comment2: By default it is a cindrical projection which is effectuated (with or without the keyword map). |
---|
| 31 | ; If we want an other projection, MAP must be activated and we have to add the keyword: /nom_projection. |
---|
| 32 | ; For example, for a polar projection centered on the south pole: |
---|
| 33 | ; IDL> domdef,-180,180,-90,-45 |
---|
| 34 | ; IDL> plt, tab, /stereo,map=[-90,0,0] |
---|
| 35 | ; |
---|
| 36 | ; @keyword NOCOLORBAR |
---|
| 37 | ; We active it if we do not want the colorbar. |
---|
| 38 | |
---|
| 39 | ;; @keyword NOFILL |
---|
| 40 | ; We active it if we only want contours in black and white with a white background. |
---|
[2] | 41 | ; |
---|
[142] | 42 | ; @keyword NOERASE |
---|
| 43 | ; We active it to make a drawing without creating a new frame. |
---|
[2] | 44 | ; |
---|
[142] | 45 | ; @keyword SMALL |
---|
| 46 | ; Vector composed of 3 or 4 elements, applyed to make a drawing on a |
---|
| 47 | ; small portion of a page or screen. It delimit the zone where the drawing will be done. |
---|
| 48 | ; If there is 4 elements: |
---|
| 49 | ; then is constituated of coordinates (expressed in cm located from the up and |
---|
| 50 | ; left corner of the page or the window (in portrait like in lanscape)) of the bottom |
---|
| 51 | ; and left corner and of the up and right corner of the drawing zone. |
---|
| 52 | ; If there is 3 elements: |
---|
| 53 | ; in this case, we divide the page or the screen in small[0] columns and in small[1] lines |
---|
| 54 | ; the drawing made in the box numbered small[2]. The numerotation starting up and left by |
---|
| 55 | ; the number 1 and then, following the writing direction. |
---|
| 56 | ; By default, we make the largest drawing we can do, conserving the aspect rapport |
---|
| 57 | ; (exept when REMPLI is activated). |
---|
| 58 | ; |
---|
| 59 | ; @keyword PORTRAIT |
---|
| 60 | ; Force the page or the window to be in standing position. |
---|
[2] | 61 | ; |
---|
[142] | 62 | ; @keyword POST |
---|
| 63 | ; Make a postscript. Only works if we made one drawing on the page. |
---|
| 64 | ; If we make several drawing, use \@ps. |
---|
[2] | 65 | ; |
---|
[142] | 66 | ; @keyword REMPLI |
---|
| 67 | ; Force the drawing to occupy the whole space defined by small. |
---|
[2] | 68 | ; |
---|
[142] | 69 | ; @keyword WINDOW |
---|
| 70 | ; Number of the window on which we want to do the graph (Allow to open several windows). |
---|
| 71 | ; By default, we open 'IDL0' |
---|
[2] | 72 | ; |
---|
[142] | 73 | ; @keyword CB_TITLE |
---|
| 74 | ; The colorbar's title |
---|
[2] | 75 | ; |
---|
[142] | 76 | ; @keyword CONTOUR |
---|
| 77 | ; If we want to trace contours of a different field than the one |
---|
| 78 | ; whose we have the colored drawing (by examlpe E-P in color and QSR in contours). |
---|
| 79 | ; It must be a field respecting same caracteristics than the argument number one of plt. |
---|
[2] | 80 | ; |
---|
[142] | 81 | ; @keyword ENDPOINTS |
---|
| 82 | ; keyword specifing that we want to make a vertical cut in diagonal. Then coorinated of extremities |
---|
| 83 | ; of these one are difined by the 4 elements of the vector ENDPOINTS: [x1,y1,x2,y2] which are |
---|
| 84 | ; coordinates. |
---|
| 85 | ; |
---|
| 86 | ; @keyword VECTEUR |
---|
| 87 | ; It is a structure composed by 2 elements containing the 2 fields U |
---|
| 88 | ; and V of values of the zonal and meridian component of the vector of the fields |
---|
| 89 | ; to draw. These fields can be an array or a structure. |
---|
| 90 | ; For example: vecteur={matriceu:lec('unsurface'),matricev:lec('vnsurface')} |
---|
| 91 | ; Comment: name of elements of vectors are inconsenquential. |
---|
| 92 | ; vecteur={u:lec('unsurface'),v:lec('vnsurface')} is also appropriated. |
---|
| 93 | ; |
---|
| 94 | ; @keyword DIREC |
---|
| 95 | ; 't' 'x' 'y' 'z' 'xys' 'xz' 'yz' 'xyz' 'xt' 'yt' 'zt' 'xyt' |
---|
| 96 | ; 'xzt' 'yzt' 'xyzt' Direction on which do averages |
---|
| 97 | ; |
---|
| 98 | ; @keyword _EXTRA |
---|
| 99 | ; Used to pass your keywords. |
---|
| 100 | ; |
---|
| 101 | ; @keyword COLOR_C |
---|
| 102 | ; To draw the contour in color instead of in black |
---|
| 103 | ; with filling in color |
---|
| 104 | ; |
---|
| 105 | ; @param POSFENETRE {out} |
---|
| 106 | ; It is a vector composed by 4 elements containing the position of the frame |
---|
| 107 | ; containing captions and the graph in normalized coorinates. |
---|
| 108 | ; Comment: To position the drawing; we have to do !p.position=posfenetre |
---|
| 109 | ; after the call of the caliber |
---|
| 110 | ; |
---|
| 111 | ; @param POSBAR {out} |
---|
| 112 | ; Like POSFENETRE but for the color bar. |
---|
| 113 | ; Same comment to position the color bar, !p.position=posbar |
---|
| 114 | ; |
---|
| 115 | ; @uses |
---|
| 116 | ; common.pro |
---|
| 117 | ; |
---|
| 118 | ; @history |
---|
| 119 | ; Sebastien Masson (smasson@lodyc.jussieu.fr) |
---|
[2] | 120 | ; 26/4/1999 |
---|
[142] | 121 | ; |
---|
| 122 | ; @version |
---|
| 123 | ; $Id$ |
---|
| 124 | ; |
---|
[2] | 125 | ;- |
---|
| 126 | ;------------------------------------------------------------ |
---|
| 127 | ;------------------------------------------------------------ |
---|
| 128 | ;------------------------------------------------------------ |
---|
[37] | 129 | PRO placedessin, typedessin, posfenetre, posbar, BARMARGES = barmarges $ |
---|
| 130 | , NOCOLORBAR = nocolorbar, NOFILL = nofill, COLOR_c = color_c $ |
---|
| 131 | , CONTOUR = contour $ |
---|
[2] | 132 | , VECTEUR = vecteur, PORTRAIT = portrait, LANDSCAPE = landscape $ |
---|
[37] | 133 | , SMALL = small, MARGES = marges, MAP = map $ |
---|
[2] | 134 | , REMPLI = REMPLI, POST = post, WINDOW = window $ |
---|
[37] | 135 | , ENDPOINTS = endpoints, TYPE = type, BASICMARGES = basicmarges $ |
---|
[2] | 136 | , NOERASE = noerase, LCT = lct, DIREC = direc, CB_TITLE = cb_title, _extra = ex |
---|
[37] | 137 | ;--------------------------------------------------------- |
---|
| 138 | ; include common |
---|
[114] | 139 | ; |
---|
| 140 | compile_opt idl2, strictarrsubs |
---|
| 141 | ; |
---|
[37] | 142 | @cm_4ps |
---|
| 143 | @cm_4mesh |
---|
| 144 | IF NOT keyword_set(key_forgetold) THEN BEGIN |
---|
| 145 | @updatekwd |
---|
| 146 | ENDIF |
---|
[2] | 147 | ;------------------------------------------------------------- |
---|
[142] | 148 | ; 1) Determination of the size of margins (unity=number of lines or columns) |
---|
| 149 | ; to the left, to the right, up and down. |
---|
| 150 | ; BEWARE in margebar, the last element is the right up corner |
---|
| 151 | ; instead of the up margin |
---|
[2] | 152 | ;------------------------------------------------------------- |
---|
[37] | 153 | if n_elements(typedessin) EQ 0 then typedessin = 'autre' |
---|
| 154 | if keyword_set(basicmarges) then begin |
---|
| 155 | marge = 1.*[6, 2, 4, 3] |
---|
| 156 | if keyword_set(marges) THEN marge = marge+marges |
---|
| 157 | margebar = 1.*[marge[0]+1, marge[1]+1, marge[2]-8, marge[2]-6] |
---|
| 158 | if keyword_set(barmarges) then margebar = margebar+barmarges |
---|
| 159 | ENDIF ELSE BEGIN |
---|
| 160 | nocolorbar = keyword_set(nocolorbar) + keyword_set(nofill) + keyword_set(color_c) |
---|
| 161 | case typedessin of |
---|
| 162 | 'plt':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 |
---|
[2] | 185 | ;-------------------------------------------------------------- |
---|
[142] | 186 | ; Portrait or landscape |
---|
[2] | 187 | ;-------------------------------------------------------------- |
---|
[69] | 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 |
---|
[2] | 195 | ;-------------------------------------------------------------- |
---|
[142] | 196 | ; What type of aspect rapport (it will be crushed if YXASPECT exist) |
---|
[2] | 197 | ;-------------------------------------------------------------- |
---|
[37] | 198 | case typedessin of |
---|
| 199 | 'plt':yaspect = 1.*(lat2-lat1)/(lon2-lon1) |
---|
| 200 | 'pltt':yaspect = 1. |
---|
| 201 | 'pltz':yaspect = .5 |
---|
| 202 | ELSE:yaspect = 1. |
---|
| 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 |
---|
[142] | 220 | ; case of the first drawing on a postcript |
---|
[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 |
---|
[142] | 226 | ; For the using of \@ps,\@oups et de \@vzoom |
---|
| 227 | if lmgr(/demo) EQ 0 then BEGIN ; Are we in the demo mode?? |
---|
| 228 | if !journal NE 0 then journal ; We close te 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 |
---|
[142] | 238 | ; When we used colors which are coded on 24bit, we can not stipulate the background color |
---|
| 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] | 254 | end |
---|