plot_overlay

PURPOSE ^

PLOT_OVERLAY - superimpose radar image to a given field

SYNOPSIS ^

function plot_overlay(md,data,options_structure,width,i)

DESCRIPTION ^

PLOT_OVERLAY - superimpose radar image to a given field

   Usage:
      plot_overlay(md,options_structure,width,i);

   See also: PLOTMODEL

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plot_overlay(md,data,options_structure,width,i)
0002 %PLOT_OVERLAY - superimpose radar image to a given field
0003 %
0004 %   Usage:
0005 %      plot_overlay(md,options_structure,width,i);
0006 %
0007 %   See also: PLOTMODEL
0008 
0009 %2d plots only
0010 if ~strcmpi(md.type,'2d'),
0011     error('plot_overlay error message: only 2d plots allowed');
0012 end
0013 
0014 %highres?
0015 if ~isnan(options_structure.highres),
0016     highres=options_structure.highres;
0017 else
0018     highres=0;
0019 end
0020 
0021 %alpha?
0022 if ~isnan(options_structure.alpha),
0023     transparency=options_structure.alpha;
0024 else
0025     transparency=1.5; %rignot setting.
0026 end
0027 
0028 %smoothing?
0029 if strcmpi(options_structure.smooth,'yes') & length(data)==md.numberofelements
0030     smoothing=1;
0031 else
0032     smoothing=0;
0033 end
0034 
0035 if ~isnan(options_structure.windowsize),
0036     windowsize=options_structure.windowsize;
0037 else
0038     windowsize=1;
0039 end
0040 
0041 %border?
0042 if ~isnan(options_structure.border),
0043     border=options_structure.border;
0044 else
0045     border=0;
0046 end
0047 
0048 [image_rgb xm ym]=buildoverlay(md,data,transparency,highres,smoothing,windowsize,border);
0049 
0050 %Select plot area
0051 subplot(width,width,i);
0052 
0053 if ~isnan(options_structure.unitmultiplier),
0054     xm=xm*options_structure.unitmultiplier;
0055     ym=ym*options_structure.unitmultiplier;
0056 end
0057 
0058 %Plot:
0059 imagesc(xm,ym,image_rgb);set(gca,'YDir','normal');
0060 
0061 %Apply options, without colorbar and without grid
0062 options_structure.colorbar=0;
0063 
0064 applyoptions(md,data,options_structure);
0065 
0066 %colorbar
0067 if ~isnan(options_structure.colorbar),
0068 
0069     %create colorbar with correct colors and position
0070     colorbar_rgb=buildoverlaycolorbar(md,data,transparency);
0071     colorbar_handle=colorbar; 
0072     colorbar_image_handle=get(colorbar_handle,'Children'); 
0073     set(colorbar_image_handle,'CData',colorbar_rgb);
0074     set(colorbar_handle,'Position',options_structure.colorbarpos);
0075 
0076     %modify ticks.
0077     if isfield(struct(md),data) data=eval(['md.' data ';']); end
0078     data(find(data<1.5))=1.5;
0079     
0080     scalestring=get(colorbar_handle,'YTickLabel');
0081     scalevalues=get(colorbar_handle,'YTick');
0082     scaleminmax=caxis;
0083     numvalues=length(scalevalues);
0084 
0085     scalestring=[];
0086     for i=1:numvalues,
0087         fraction=(scalevalues(i)-scaleminmax(1))/(scaleminmax(2)-scaleminmax(1));
0088         scalevalues(i)=exp(min(log(data))+(max(log(data))-min(log(data)))*fraction);
0089 
0090         scalestring=[scalestring; sprintf('%8.4g',scalevalues(i))];
0091     end
0092     set(colorbar_handle,'YTickLabel',scalestring);
0093     set(colorbar_handle,'YColor','y');
0094     set(colorbar_handle,'FontSize',16);
0095 end
0096 
0097 %take axis off
0098 axis off;
0099 
0100 %put axis equal
0101 axis equal;

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003