1 | ;------------------------------------------------------------ |
---|
2 | ;------------------------------------------------------------ |
---|
3 | ;------------------------------------------------------------ |
---|
4 | ;+ |
---|
5 | ; NAME:PLACECOLOR |
---|
6 | ; |
---|
7 | ; PURPOSE:permet de tracer la colorbar independammment d'un graphe |
---|
8 | ; |
---|
9 | ; CATEGORY:graph |
---|
10 | ; |
---|
11 | ; CALLING SEQUENCE:placecolor,pos |
---|
12 | ; |
---|
13 | ; INPUTS: |
---|
14 | ; pos:vecteur de 4 elements donnant les coordonnees du coin en bas |
---|
15 | ; a gauche et de celui en haut a droite -en cm- ds lequel on veut faire la |
---|
16 | ; barre de couleur |
---|
17 | ; |
---|
18 | ; KEYWORD PARAMETERS: tous ceux de colorbar.pro. |
---|
19 | ; |
---|
20 | ; par defaut trace une barre de couleur du meme type que celle presente ds plt |
---|
21 | ; et pltz. si max, min et divisions ne sont pas stipulees alors max=sup,min=inf |
---|
22 | ; et divisions=div |
---|
23 | ; |
---|
24 | ; OUTPUTS: |
---|
25 | ; |
---|
26 | ; COMMON BLOCKS: |
---|
27 | ; common.pro |
---|
28 | ; |
---|
29 | ; SIDE EFFECTS: |
---|
30 | ; |
---|
31 | ; RESTRICTIONS:utilisable que pour les POSTCRIPT effectues avec plein2dessin |
---|
32 | ; |
---|
33 | ; EXAMPLE: |
---|
34 | ; |
---|
35 | ; MODIFICATION HISTORY: Sebastien Masson (smasson@lodyc.jussieu.fr) |
---|
36 | ; 7/5/98 |
---|
37 | ;- |
---|
38 | ;------------------------------------------------------------ |
---|
39 | ;------------------------------------------------------------ |
---|
40 | ;------------------------------------------------------------ |
---|
41 | pro placecolor, pos, _extra = ex |
---|
42 | ;------------------------------------------------------------ |
---|
43 | ; include commons |
---|
44 | ; |
---|
45 | compile_opt idl2, strictarrsubs |
---|
46 | ; |
---|
47 | @cm_4ps |
---|
48 | IF NOT keyword_set(key_forgetold) THEN BEGIN |
---|
49 | @updatenew |
---|
50 | ENDIF |
---|
51 | ;--------------------- |
---|
52 | ; |
---|
53 | xsave = !x |
---|
54 | ysave = !y |
---|
55 | psave = !p |
---|
56 | ; |
---|
57 | reinitplt, /z, /invert |
---|
58 | pos=1.*pos |
---|
59 | mipgsz = min(page_size, max = mapgsz) |
---|
60 | if key_portrait eq 1 then begin |
---|
61 | pos[0]=pos[0]/mipgsz |
---|
62 | pos[1]=pos[1]/mapgsz |
---|
63 | pos[2]=pos[2]/mipgsz |
---|
64 | pos[3]=pos[3]/mapgsz |
---|
65 | endif else begin |
---|
66 | pos[0]=pos[0]/mapgsz |
---|
67 | pos[1]=pos[1]/mipgsz |
---|
68 | pos[2]=pos[2]/mapgsz |
---|
69 | pos[3]=pos[3]/mipgsz |
---|
70 | ENDELSE |
---|
71 | ; |
---|
72 | def_myuniquetmpdir |
---|
73 | ; |
---|
74 | IF lmgr(/demo) EQ 1 THEN BEGIN |
---|
75 | ; if we are in demo mode, we cannot save the parameters in a temporary file... |
---|
76 | @cm_demomode_used |
---|
77 | ; |
---|
78 | colnumb = colorbarparam.colnumb |
---|
79 | clbinf = colorbarparam.clbinf |
---|
80 | clbsup = colorbarparam.clbsup |
---|
81 | clbdiv = colorbarparam.clbdiv |
---|
82 | ; |
---|
83 | ENDIF ELSE BEGIN |
---|
84 | file = myuniquetmpdir + '4colorbar.dat' |
---|
85 | IF file_test(file) THEN BEGIN |
---|
86 | restore, file |
---|
87 | if size(ex, /type) EQ 8 then BEGIN |
---|
88 | if (where(tag_names(ex) EQ 'MIN'))[0] NE -1 then clbinf = ex.MIN |
---|
89 | if (where(tag_names(ex) EQ 'MAX'))[0] NE -1 then clbsup = ex.MAX |
---|
90 | if (where(tag_names(ex) EQ 'DIVISIONS'))[0] NE -1 then clbdiv = ex.DIVISIONS |
---|
91 | ENDIF |
---|
92 | ; |
---|
93 | COLORBAR, COLOR = 0, DIVISIONS = clbdiv, DISCRET = colnumb $ |
---|
94 | , cb_color = 0, POSITION = pos, MAX = clbsup $ |
---|
95 | , MIN = clbinf, cb_charsize = !p.charsize $ |
---|
96 | , _extra = ex |
---|
97 | ENDIF |
---|
98 | ENDELSE |
---|
99 | ; |
---|
100 | !x = xsave |
---|
101 | !y = ysave |
---|
102 | !p = psave |
---|
103 | ;------------------------------------------------------------ |
---|
104 | return |
---|
105 | end |
---|