;+ ; ; @file_comments ; Putting into place of the drawing/ opening of the window or of the PS ; ; @categories ; Utilities ; ; @param TYPEDESSIN {type=string} ; It specify what procedure is called by placedessin : ; 'plt', 'pltz' or 'pltt' ; ; @param POSFENETRE {out}{type=vector} ; containing captions and the graph in normalized coordinates. ; Comment: To position the drawing, we have to do !p.position=posfenetre ; after the call of the caliber ; ; @param POSBAR {out}{type=vector} ; Like POSFENETRE but for the color bar. ; Same comment to position the color bar, !p.position=posbar ; ; @param dtasize {in}{optional}{type=2 elements vector} ; used by pltv to specify the size of the array that will be plotted ; and therefore the default yxaspect to be used. ; ; @keyword LANDSCAPE ; Force the page or the window on the screen to be in lengthened position. ; ; @keyword LCT {type=integer} ; It designate the number of the palette of color we want to use for the plot. ; ; @keyword MAP ; We use it when we want to do a projection. ; This keyword can be of two types: ; MAP=[P0lat,P0lon,Rot]. For the description of these 3 values (see the online help of map_set). ; /MAP: In this case, map is automatically calculated have the value: ; map = [0, (lon1+lon2)/2., 0] ; Comment 1: A good way to choose the type of the projection we want to do is to have a look at IDL demo: ; IDL> demo ; Then choose "Mapping" and "Global Mapping Demo" ; Comment 2: By default it is a cylindrical projection which is effectuated (with or without the keyword map). ; If we want an other projection, MAP must be activated and we have to add the keyword: /nom_projection. ; For example, for a polar projection centered on the south pole: ; IDL> domdef,-180,180,-90,-45 ; IDL> plt, tab, /stereo,map=[-90,0,0] ; ; @keyword NOCOLORBAR ; We active it if we do not want the colorbar. ; @keyword NOFILL ; We active it if we only want contours in black and white with a white background. ; ; @keyword NOERASE ; We active it to make a drawing without creating a new frame. ; ; @keyword SMALL ; Vector composed of 3 or 4 elements, applied to make a drawing on a ; small portion of a page or screen. It delimit the zone where the drawing will be done. ; If there is 4 elements: ; then is constituted of coordinates (expressed in cm located from the up and ; left corner of the page or the window (in portrait like in landscape) of the bottom ; and left corner and of the up and right corner of the drawing zone. ; If there is 3 elements: ; in this case, we divide the page or the screen in small[0] columns and in small[1] lines ; the drawing made in the box numbered small[2]. The numerotation starting up and left by ; the number 1 and then, following the writing direction. ; By default, we make the largest drawing we can do, conserving the aspect ratio ; (except when REMPLI is activated). ; ; @keyword PORTRAIT ; Force the page or the window to be in standing position. ; ; @keyword POST ; Make a postscript. Only works if we made one drawing on the page. ; If we make several drawing, use \@ps. ; ; @keyword REMPLI ; Force the drawing to fill the whole space defined by small. ; ; @keyword WINDOW ; Number of the window on which we want to do the graph (Allow to open several windows). ; By default, we open 'IDL0' ; ; @keyword CB_TITLE ; The colorbar's title ; ; @keyword CONTOUR ; If we want to trace contours of a different field than the one ; whose we have the colored drawing (by example E-P in color and QSR in contours). ; It must be a field respecting same characteristics than the argument number ; one of plt. ; ; @keyword ENDPOINTS ; keyword specifying that we want to make a vertical cut in diagonal. Then coordinated of extremities ; of these ones are defined by the 4 elements of the vector ENDPOINTS: [x1,y1,x2,y2] which are ; coordinates. ; ; @keyword VECTEUR {type=vector} ; It is a structure composed by 2 elements containing the 2 fields U ; and V of values of the zonal and meridian component of the vector of the fields ; to draw. These fields can be an array or a structure. ; For example: vecteur={matriceu:lec('unsurface'),matricev:lec('vnsurface')} ; Comment: name of elements of vectors are inconsequential. ; vecteur={u:lec('unsurface'),v:lec('vnsurface')} is also appropriated. ; ; @keyword DIREC ; 't' 'x' 'y' 'z' 'xys' 'xz' 'yz' 'xyz' 'xt' 'yt' 'zt' 'xyt' ; 'xzt' 'yzt' 'xyzt' Direction on which do averages ; ; @keyword _EXTRA ; Used to pass keywords ; ; @keyword COLOR_C ; To draw the contour in color instead of in black ; with filling in color ; ; @uses ; common ; ; @history ; Sebastien Masson (smasson\@lodyc.jussieu.fr) ; 26/4/1999 ; ; @version ; $Id$ ; ;- PRO placedessin, typedessin, posfenetre, posbar, dtasize, BARMARGES=barmarges $ , NOCOLORBAR=nocolorbar, NOFILL=nofill, COLOR_c=color_c $ , CONTOUR=contour $ , VECTEUR=vecteur, PORTRAIT=portrait, LANDSCAPE=landscape $ , SMALL=small, MARGES=marges, MAP=map $ , REMPLI=REMPLI, POST=post, WINDOW=window $ , ENDPOINTS=endpoints, TYPE=type, BASICMARGES=basicmarges $ , NOERASE=noerase, LCT=lct, DIREC=direc, CB_TITLE=cb_title $ , _EXTRA=ex ; compile_opt idl2, strictarrsubs ; @cm_4ps @cm_4mesh IF NOT keyword_set(key_forgetold) THEN BEGIN @updatekwd ENDIF ;------------------------------------------------------------- ; 1) Determination of the size of margins (unity=number of lines or columns) ; to the left, to the right, up and down. ; BEWARE in margebar, the last element is the right up corner ; instead of the up margin ;------------------------------------------------------------- if n_elements(typedessin) EQ 0 then typedessin = 'autre' if keyword_set(basicmarges) then begin marge = 1.*[6, 2, 4, 3] if keyword_set(marges) THEN marge = marge+marges margebar = 1.*[marge[0]+1, marge[1]+1, marge[2]-8, marge[2]-6] if keyword_set(barmarges) then margebar = margebar+barmarges ENDIF ELSE BEGIN nocolorbar = keyword_set(nocolorbar) + keyword_set(nofill) + keyword_set(color_c) case typedessin of 'plt':marge = 1.*[6, 2, 4, 3] 'pltv':marge = 1.*[6, 2, 4, 3] 'pltt':marge = 1.*[6+4*(type EQ 'xt'), 2, 4, 4] 'pltz':marge = 1.*[6, 2, 4, 3] else:marge = 1.*[6, 2, 4, 3] ENDCASE if keyword_set(marges) THEN marge = marge+marges if NOT keyword_set(barmarges) then barmarges = replicate(0, 4) barmarges[3] = -barmarges[3] margebar = 1.*[marge[0]+1, marge[1]+1, 2, 4]+barmarges marge = marge+[0, 0, 4, 0]*keyword_set(cb_title) IF keyword_set(direc) THEN $ marge = marge+[0, 0, 2, 0]*(strlowcase(direc) NE 't') marge = marge+[0, 0, 2, 0]*keyword_set(contour) marge = marge+[0, 0, 2, 0]*keyword_set(vecteur) if n_elements(lon1) NE 0 and n_elements(lon2) NE 0 $ and n_elements(lat1) NE 0 and n_elements(lat2) NE 0 then begin if keyword_set(type) then $ marge = marge+[0, 3*(type EQ 'yt' AND lon1 NE lon2), 0 $ , 2*(type NE 'yt' AND lat1 NE lat2)]*keyword_set(endpoints) $ ELSE marge = marge+[0, 0, 0, 2*(lat1 NE lat2)]*keyword_set(endpoints) endif marge = marge+[0, 0, 2+margebar[3], 0]*(1-keyword_set(nocolorbar)) ENDELSE ;-------------------------------------------------------------- ; Portrait or landscape ;-------------------------------------------------------------- IF NOT keyword_set(noerase) THEN BEGIN CASE 1 OF n_elements(portrait) NE 0:key_portrait = portrait n_elements(landscape) NE 0:key_portrait = 1-landscape ELSE: ENDCASE ENDIF ;-------------------------------------------------------------- ; What type of aspect ratio(it will be crushed if YXASPECT exist) ;-------------------------------------------------------------- case typedessin of 'plt':yaspect = 1.*(lat2-lat1)/(lon2-lon1) 'pltt':yaspect = 1. 'pltz':yaspect = .5 'pltv':yaspect = float(dtasize[1])/float(dtasize[0]) ELSE:yaspect = 1. ENDCASE ;------------------------------------------------------------- ; 2) calculation of !p.position ; see calibre.pro. ;------------------------------------------------------------ ; IF NOT keyword_set(small) then small = [1, 1, 1] ; if keyword_set(map) then rempli = 1 ; calibre, yaspect, marge, margebar, small, posfenetre, posbar, REMPLI = rempli, _extra = ex ; !p.position = posfenetre ;------------------------------------------------------------ ; 3) opening of the graphic window or of the postscript ;------------------------------------------------------------ case 1 of ; case of the first drawing on a postscript keyword_set(post) AND !d.name ne 'PS':openps, _extra = ex ; case of the first drawing on a screen keyword_set(post) EQ 0 AND keyword_set(noerase) EQ 0 $ AND !d.name ne 'PS' AND !d.name ne 'Z':BEGIN if not keyword_set(window) then window = 0 ; For the using of \@ps,\@oups and \@vzoom if lmgr(/demo) EQ 0 then BEGIN ; Are we in the demo mode?? if !journal NE 0 then journal ; We close the journal if it is open homedir = isadirectory(io = homedir, title = 'Bad definition of homedir') def_myuniquetmpdir journal, myuniquetmpdir+'idlsave.pro' ; We open a new one help, /recall_commands, output = listecommande ; We recuperate the last command listecommande = strmid(strcompress(listecommande[1]), 2) journal, listecommande ; We write it in the journal ENDIF windsize = givewindowsize() window, window, xsize = windsize[0], ysize = windsize[1], retain = 2, _extra = ex ; When we used colors which are coded on 24bit, we can not stipulate the background color ; of a window thanks to !p.background, so we have to to this: ; if !d.n_colors gt 256 then begin ; device, decomposed=1 ; !p.background='ffffff'x ; plot,[0],[0], /nodata, xstyle = 4, ystyle = 4 ; device, decomposed=0 ; endif END ELSE: endcase ;------------------------------------------------------------ if n_elements(lct) NE 0 then lct, lct, _extra = ex ;------------------------------------------------------------ return end