; print legend (line + text) in pltt type 't' (called from plt_map) ; domain_y = minc,maxc / ; domaint=time(0), time(jptmax-1) IF debug_w THEN print, ' in legend_pltt_over, iover=', iover ; ; decode legend format from command line (see def_work cmdi.proj) ; leg_pos = strmid(leg_format, 0, 2); (UR=-1, UL, LR, LL) IF strpos(leg_format, '_') NE -1 THEN BEGIN txt_format = strmid(leg_format, 3, strlen(leg_format)) ENDIF ELSE BEGIN txt_format = default_txt_format ENDELSE ; when there is more than one seasonal cycle jptmax = jpt * nb_cycles IF debug_w THEN print, 'jpt, jptmax, nb_cycles ', jpt, jptmax, nb_cycles ; legend line text leg_txt = '' IF strpos(txt_format, 'E') NE -1 THEN leg_txt = leg_txt+cmd.exp+' ' IF strpos(txt_format, 'V') NE -1 THEN leg_txt = leg_txt+cmd.var+' ' IF strpos(txt_format, 'L') NE -1 THEN leg_txt = leg_txt+field.legend+' ' IF strpos(txt_format, 'U') NE -1 THEN leg_txt = leg_txt+'('+field.units+') ' IF strpos(txt_format, 'B') NE -1 THEN leg_txt = leg_txt+legz+' ' IF debug_w THEN print, ' leg_pos, leg_txt = ', leg_pos, leg_txt ; px_n = percentage of window size function of number of windows ; initial percentage px_1r is function of strlen(leg_txt) ; n_leg_max = max number of lines in legend box CASE nwin_tot OF 1: BEGIN px_1r = float(93-strlen(leg_txt))/100 px_2r = px_1r+0.05 & px_1l = 0.03 & px_2l = 0.08 n_leg_max = 20 & txt_ft_size = 1.4 & y_scale_txt = 0.998 delta_txt_add = 0.05 END 2: BEGIN px_1r = float(84-strlen(leg_txt))/100 px_2r = px_1r+0.1 & px_1l = 0.03 & px_2l = 0.13 n_leg_max = 20 & txt_ft_size = 1.4 & y_scale_txt = 0.995 delta_txt_add = 0.07 END 3: BEGIN px_1r = float(84-strlen(leg_txt))/100 px_2r = px_1r+0.1 & px_1l = 0.03 & px_2l = 0.13 n_leg_max = 10 & txt_ft_size = 1.2 & y_scale_txt = 0.995 delta_txt_add = 0.1 END ELSE: BEGIN px_1r = float(75-strlen(leg_txt))/100 px_2r = px_1r+0.1 & px_1l = 0.03 & px_2l = 0.13 n_leg_max = 10 & txt_ft_size = 1.2 & y_scale_txt = 0.993 delta_txt_add = 0.1 END ENDCASE ; size between end of line and text (% of window size) delta_txt = 0.01 px_tr = px_2r+delta_txt px_tl = px_2l+delta_txt IF debug_w THEN print, ' nwin_tot, n_leg_max = ', nwin_tot, n_leg_max delta = float(maxc-minc)/(float(n_leg_max)+2.) ; position of legend line (x_leg_1 to 2,y_leg) and text x_leg_t,; y_leg_t IF strmid(leg_pos, 0, 1) EQ 'L' THEN BEGIN ; (L)ower y_leg = minc+(nover-float(iover)+0.5)*delta ENDIF ELSE BEGIN ; (U)pper y_leg = maxc-(float(iover))*delta ENDELSE ; special case of plt1d,'z' IF plttyp EQ 'plt1d' AND plt1dtyp EQ 'z' THEN BEGIN ymin = boite_plt1d(4) ymax = boite_plt1d(5) y_dim = boite_plt1d(5)-boite_plt1d(4) delta = y_dim/(float(n_leg_max)+2.) IF strmid(leg_pos, 0, 1) EQ 'L' THEN BEGIN ; (L)ower y_leg = ymax-(nover-float(iover)+0.5)*delta ENDIF ELSE BEGIN ; (U)pper y_leg = ymin+(float(iover)+0.5)*delta ENDELSE ENDIF y_leg_t = y_leg*y_scale_txt ; case pltt plt1d IF debug_w THEN print, 'size(time) ', size(time) CASE plttyp OF 'pltt': BEGIN IF strmid(leg_pos, 1, 1) EQ 'L' THEN BEGIN ; (L)eft x_leg_1 = time(floor(px_1l*(jptmax-1))) x_leg_2 = time(floor(px_2l*(jptmax-1))) x_leg_t = time(floor(px_tl*(jptmax-1))) ENDIF ELSE BEGIN ; (R)ight x_leg_1 = time(floor(px_1r*(jptmax-1))) x_leg_2 = time(floor(px_2r*(jptmax-1))) x_leg_t = time(floor(px_tr*(jptmax-1))) ENDELSE END 'plt1d': BEGIN CASE plt1dtyp OF 'x': BEGIN xmin = boite_plt1d(0) x_dim = boite_plt1d(1)-boite_plt1d(0) END 'y': BEGIN xmin = boite_plt1d(2) x_dim = boite_plt1d(3)-boite_plt1d(2) END 'z': BEGIN xmin = minc x_dim = maxc-minc END ELSE: ENDCASE IF strmid(leg_pos, 1, 1) EQ 'L' THEN BEGIN ; (L)eft x_leg_1 = xmin+px_1l*x_dim x_leg_2 = xmin+px_2l*x_dim x_leg_t = xmin+px_tl*x_dim ENDIF ELSE BEGIN ; (R)ight x_leg_1 = xmin+px_1r*x_dim x_leg_2 = xmin+px_2r*x_dim x_leg_t = xmin+px_tr*x_dim ENDELSE END ENDCASE leg = [y_leg, y_leg] ; draw line overc_l = strmid(overc,7, strlen(overc)-1) CASE plttyp OF 'pltt': BEGIN time = [x_leg_1, x_leg_2] jpt_o = jpt jpt = 2 pltcmd = 'pltt, leg, '+''''+'t'+''''+overc_l+ ',ov1d=1'+',/noerase' res = execute(pltcmd) jpt = jpt_o END 'plt1d': BEGIN x_leg = [x_leg_1, x_leg_2] pltcmd = 'oplot,x_leg,leg'+colov+line_thick_txt+', LINESTYLE='+string(line_style(iover-1)-1) res = execute(pltcmd) END ENDCASE IF debug_w THEN print, overc_l ; draw text xyouts, x_leg_t, y_leg_t, leg_txt, charsize = txt_ft_size, color = string(line_color(iover-1)), charthick = 1., font = 1.