;8 PRO print_plot, x, y, a_1, a_2, a_3, a_4, a_5, a_6, a_7, a_8, a_9, a_10, a_11, a_12, a_13, a_14, a_15, a_16, a_17, a_18, a_19, a_20, y_order=a_y_order, _EXTRA = e , x_altaxis = a_x_axis, y_default = y_default, plot_end=ee, xrange = a_xrange, print_plot=print, plot_plot=plot, plot_file=file, plot_printer=pprint, nodata=a_nodata @~vgr/idl/common.types ; ; ; NAME: ; print_plot ; ; PURPOSE: ; plots & prints plots stacked ; plots in color , icolor, default 1 ; ; CATEGORY: ; ; CALLING SEQUENCE: ; print_plot ; ; INPUTS: ; ; ; KEYWORDS: ; None. ; ; OUTPUTS: ; ; COMMON plt_common ; p_number number of plot boxes, p_num_x * p_num_y ; p_num_x number of columns of plots ; p_num_y number of rows of plots ; p_type type of plot, (to be implimented) ; p_num number of curent plot, only used if modifyinf indivigual plot ; p_x_max max x value ; p_x_min min x value ; p_y_max max y value ; p_y_min min y value ; p_xrange range of x used for plotting ; p_yrange range of y used for plotting (normal) ; p_yrange_good range of y used for plotting ( 'outters outted' ) ; p_yrange_type which yrange used, 0 => [ p_y_min, p_y_max], 1 => p_yrange, 2 => _yrange_good, 3 => p_yrange , with outters highlighted ; p_x array of x values ; p_y array of y values ; p_psym psym for each plot ; p_symsize symsize for each plot ; p_color color for each plot ; p_label label for each plot ; p_y_log if set, plot log of y value ; p_x_axis alternate x axis, ( 0 or undefined => normal, 1 => year_day, 2 => index for x axis, 3 => hystogram axis, 4 => filled histogram ) ; p_y_axis alternate y axis on right, 0 or undefined => normal, 1 => day_year, 2 => deg (K) ; p_clip clip reagions for each frame ; p_end set form keyword plot_end, 0 => not set, 1 => print after this print_plot, 2 => do not print after print_plot, 3 => print impending plot, do nothing else ; p_file name of plot file, (idl.ps) ; printer name ot printer to be used, (default is users default) ; p_y_order 0 or unset => top down, 1 => bottem up ; ; SIDE EFFECTS ; None. ; ; PROCEDURE: ; ; ;- @~vgr/idl/print_plot_common.pro if ( n_elements( print) gt 0 ) then print_plot = print if ( n_elements( print_plot ) eq 0 ) then print_plot = 0 if ( n_elements( plot_plot ) eq 0 ) then plot_plot = 1 if ( n_elements( plot ) gt 0 ) then plot_plot = plot if ( n_elements( y_default) lt 1 ) then yy_default = 2 else yy_default = y_default if ( n_elements( p_end) eq 0 ) then begin p_end = 0 endif if ( n_elements( ee) gt 0 ) then begin p_end = ee endif if ( n_elements( p_file) le 0 ) then begin p_file = 'idl' endif if ( n_elements( file) gt 0 ) then begin p_file = file endif if ( n_elements( pprint) gt 0 ) then begin printer = pprint end else if ( n_elements( printer) le 0 ) then begin printer='' end if ( p_end eq 3 ) then begin if ( print_plot gt 0 ) then begin set_plot,'PS' device,/close set_plot,'X' if ( strlen ( printer) gt 1 ) then begin ppp = 'lpr -h -P' + printer + ' ' + p_file end else begin ppp = 'lpr -h ' + p_file endelse spawn , ppp help,ppp endif !p.multi = pm !y.margin = ym !y.omargin = yom !p.charsize = pc !x.ticklen = tl pm = 0 return endif if ( n_elements( a_nodata) eq 0 ) then p_nodata = 0 else p_nodata = a_nodata n_p = n_params() if ( n_elements( a_xrange) gt 0) then p_xrange = a_xrange if ( n_elements( a_yrange) gt 0) then p_yrange = a_yrange if ( n_elements( a_x_axis) gt 0 ) then p_x_axis=a_x_axis if ( n_elements( p_x_axis) le 0 ) then p_x_axis=0 CASE n_p of 0: begin if ( n_elements( y_default) gt 0 ) then p_yrange_type = 0*p_yrange_type + y_default end 1: print_plot_set, x , y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 2: print_plot_set, x, y , y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 3: print_plot_set, x, y, a_1 , y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 4: print_plot_set, x, y, a_1, a_2 , y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 5: print_plot_set, x, y, a_1, a_2, a_3 , y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 6: print_plot_set, x, y, a_1, a_2, a_3, a_4 , y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 7: print_plot_set, x, y, a_1, a_2, a_3, a_4, a_5 , y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 8: print_plot_set, x, y, a_1, a_2, a_3, a_4, a_5, a_6 , y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 9: print_plot_set, x, y, a_1, a_2, a_3, a_4, a_5, a_6, a_7 , y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 10: print_plot_set, x, y, a_1, a_2, a_3, a_4, a_5, a_6, a_7, a_8 , y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 11: print_plot_set, x, y, a_1, a_2, a_3, a_4, a_5, a_6, a_7, a_8, a_9 , y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 12: print_plot_set, x, y, a_1, a_2, a_3, a_4, a_5, a_6, a_7, a_8, a_9, a_10 , y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 13: print_plot_set, x, y, a_1, a_2, a_3, a_4, a_5, a_6, a_7, a_8, a_9, a_10, a_11 , y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 14: print_plot_set, x, y, a_1, a_2, a_3, a_4, a_5, a_6, a_7, a_8, a_9, a_10, a_11, a_12 , y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 15: print_plot_set, x, y, a_1, a_2, a_3, a_4, a_5, a_6, a_7, a_8, a_9, a_10, a_11, a_12, A_13 , y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 16: print_plot_set, x, y, a_1, a_2, a_3, a_4, a_5, a_6, a_7, a_8, a_9, a_10, a_11, a_12, A_13, a_14 , y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 17: print_plot_set, x, y, a_1, a_2, a_3, a_4, a_5, a_6, a_7, a_8, a_9, a_10, a_11, a_12, A_13, a_14, a_15 , y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 18: print_plot_set, x, y, a_1, a_2, a_3, a_4, a_5, a_6, a_7, a_8, a_9, a_10, a_11, a_12, A_13, a_14, a_15 , a_16, y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 19: print_plot_set, x, y, a_1, a_2, a_3, a_4, a_5, a_6, a_7, a_8, a_9, a_10, a_11, a_12, A_13, a_14, a_15 , a_16, a_17, y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 20: print_plot_set, x, y, a_1, a_2, a_3, a_4, a_5, a_6, a_7, a_8, a_9, a_10, a_11, a_12, A_13, a_14, a_15 , a_16, a_17, a_19, y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e 21: print_plot_set, x, y, a_1, a_2, a_3, a_4, a_5, a_6, a_7, a_8, a_9, a_10, a_11, a_12, A_13, a_14, a_15 , a_16, a_17, a_19, a_20, y_default = yy_default, xrange = a_xrange, x_altaxis=p_x_axis, _EXTRA = e ELSE: begin MESSAGE,'wrong number of arguments' return end ENDCASE if ( n_elements( psa ) lt 10 ) then begin ;psa = [ 1, 2, 2.5, 3, 3.33, 3.66, 4, 4.25, 4.5, 4.75, 5, 5.2, 5.4, 5.6, 5.8, 6] psa=fltarr( 23,/nozero) for i=0,22 do psa( i) = 1. + alog( i+1) endif p_clip = intarr( 6, p_number + 1) yom = !y.omargin ym = !y.margin pm = !p.multi pc = !p.charsize tl = !x.ticklen !y.omargin = [2,1] !y.omargin = [3,1] !y.margin=[ 0, 0] !p.multi=[ 0, p_num_x, p_num_y, 0, 0] !p.charsize = psa( p_number - 1.) p_yom = !y.omargin p_ym = !y.margin p_pm = !p.multi p_pc = !p.charsize p_tl = !x.ticklen if ( p_x_axis eq 1 ) then begin !x.ticklen = 0.00000001 endif ii = 0 p_title_0 = !p.title !p.title = '' if ( n_elements( a_y_order) gt 0 ) then p_y_order = a_y_order else p_y_order = 0 for i=1,2 do begin ; plot on screen then printer p_p = 0 if ( ( i eq 1) and ( plot_plot gt 0 ) ) then begin ii = ii + 1 p_p = 1 endif else if ( ( i eq 2) and ( print_plot gt 0 ) ) then begin set_plot,'PS' if ( print_plot eq 3 ) then begin device,/landscape,filename=p_file end else if ( print_plot eq 5 ) then begin device,/landscape,filename=p_file,xsize=28,ysize=21,xoffset=0.3,yoffset=28 end else if ( print_plot eq 4 ) then begin device,/portrait,filename=p_file,ysize=26,yoffset=1,xsize=20,xoffset=1 end else if ( print_plot eq 6 ) then begin device,/portrait,filename=p_file,ysize=27.5,yoffset=0.2,xsize=21.5,xoffset=0.0 end else device,filename=p_file ii = ii + 10 p_p = 1 endif x_r_margin = 0 for p_i=0, p_number-1 do begin case p_y_axis( p_i) of 0: x_r_margin = max([ x_r_margin, 3]) 1: x_r_margin = max([ x_r_margin, 1]) 2: x_r_margin = max([ x_r_margin, 8]) else: print ,"y_altaxis not supported ",p_i,p_y_axis endcase endfor !x.margin(1) = x_r_margin if ( p_p eq 1 ) then begin !x.tickname = ' ' for p_ii=0,p_number-1 do begin if ( P_y_order gt 0 ) then p_i = p_number - p_ii - 1 else p_i = p_ii case p_y_axis(p_ii) of 0: ystyle = !x.style 1: ystyle = !x.style or 4 2: ystyle = !x.style or 8 ELSE: begin print ,"y_axis not supported p_ii", p_ii, " x._axis ", p_y_axis ystyle = !x.style end endcase if ( ( ( p_ii + 1) mod p_num_y eq 0) and ( p_x_axis ne 1) ) then begin !x.tickname = '' endif yrange = [ p_y_min( p_i), p_y_max( p_i)] n_p_x = n_elements(p_x) case p_yrange_type( p_i) of 0: begin plot, p_x, p_y( *, p_i), ytitle=p_label( p_i),psym=p_psym( p_i), symsize=p_symsize( p_i), color=p_color( p_i), xrange=p_xrange, yrange=[ p_y_min( p_i), p_y_max( p_i)], ytype=p_y_log( p_i), ystyle=ystyle, nodata=p_nodata yrange = [ p_y_min( p_i), p_y_max( p_i)] end 1: begin plot, p_x, p_y( *, p_i), ytitle=p_label( p_i),psym=p_psym( p_i), symsize=p_symsize( p_i), color=p_color( p_i), xrange=p_xrange, yrange=p_yrange( *, p_i), ytype=p_y_log( p_i), ystyle=ystyle, nodata=p_nodata yrange = p_yrange( *, p_i) end 2: begin plot, p_x, p_y( *, p_i), ytitle=p_label( p_i),psym=p_psym( p_i), symsize=p_symsize( p_i), color=p_color( p_i), xrange=p_xrange, yrange=p_yrange_good( *, p_i), ytype=p_y_log( p_i), ystyle=ystyle, nodata=p_nodata yrange = p_yrange_good( *, p_i) end 3: begin plot, p_x, p_y( *, p_i), ytitle=p_label( p_i),psym=p_psym( p_i), symsize=p_symsize( p_i), color=p_color( p_i), xrange=p_xrange, yrange=p_yrange( *, p_i), ytype=p_y_log( p_i), ystyle=ystyle, nodata=p_nodata ip = where( ( p_y( *, p_i) lt p_yrange_good( 0, p_i)) or ( p_y( *, p_i) gt p_yrange_good( 1, p_i))) if ( p_nodata eq 0 ) then oplot, p_x( ip), p_y( ip, p_i), psym=1, symsize=p_symsize( p_i), color=p_color( p_i) yrange = p_yrange( *, p_i) end else:begin print,"p_yrange_type out of range ", p_yrange_type,", for p_i ", p_i yrange = p_yrange( *, p_i) return end endcase ; just in case we want to fill a histogram if ( p_x_axis eq 4 ) then begin polyfill, p_x, p_y( *, p_i) endif ; now to do right axis case p_y_axis(p_i) of 0: 1: begin xrange = p_xrange year_day_y,p_yrange( *, p_i) end 2: begin tt_n = p_xrange(1) l_tt = p_xrange(1) - p_xrange(0) d_t = l_tt/100. d_tt = 3.0*d_t d_t = 0.5*d_t oplot,[tt_n+d_t, tt_n-d_tt], [4.07,4.07],color=p_color(p_i),/noclip xyouts,tt_n+d_tt/3,4.07,'3' oplot,[tt_n+d_t, tt_n-d_tt], [12.88,12.88],color=p_color(p_i),/noclip xyouts,tt_n+d_tt/3,12.88,'4' oplot,[tt_n+d_t, tt_n-d_tt], [40.72,40.72],color=p_color(p_i),/noclip xyouts,tt_n+d_tt/3,40.72,'5' xyouts,tt_n+d_tt,20.0,'T (K)',orientation=90 oplot,[tt_n,tt_n],yrange,color=p_color(p_i) end ELSE: begin print ,"y_axis not supported p_i", p_i, " p_y_axis ", p_y_axis ystyle = !x.style end endcase p_clip( *, p_i) = !p.clip if ( p_x_axis eq 1 ) then begin if ( ( p_ii + 1) mod p_num_y eq 0) then begin !x.tickname = '' endif year_day, p_xrange , ytype=p_y_log( p_i) endif endfor endif y0 = -(!y.s(0)/!y.s(1)) ;y00 = ( y0 + yrange(0))/2 xd0 = p_xrange(1) - p_xrange(0) x0 = p_xrange(0) + 0.5*xd0 xyouts,x0,y0,p_title_0,charsize=1.5,alignment=0.5 if ( ( i eq 1) and ( plot_plot gt 0 ) ) then begin ii = ii + 100 endif else if ( ( i eq 2) and ( print_plot gt 0 ) ) then begin ii = ii + 1000 ; if ( print_plot eq 1 ) then begin ; device,/close ; if ( n_elements( printer) gt 0 ) then begin ; ppp = 'lpr -P printer -h ' + p_file ; end else begin ; ppp = 'lpr -h ' + p_file ; endelse ; spawn , ppp ; endif set_plot,'X' endif endfor !p.title = p_title_0 if ( p_end eq 1 ) then begin if ( plot_plot gt 0 ) then begin set_plot,'PS' device,/close set_plot,'X' if ( strlen ( printer) gt 1 ) then begin ppp = 'lpr -h -P' + printer + ' ' + p_file end else begin ppp = 'lpr -h ' + p_file endelse spawn , ppp help,ppp endif !p.multi = pm !y.margin = ym !y.omargin = yom !p.charsize = pc !x.ticklen = tl pm = 0 return endif !p.multi = pm !y.margin = ym !y.omargin = yom !p.charsize = pc !x.ticklen = tl end ; print_plot