0001 function plot_overlay(md,data,options_structure,width,i)
0002
0003
0004
0005
0006
0007
0008
0009
0010 if ~strcmpi(md.type,'2d'),
0011 error('plot_overlay error message: only 2d plots allowed');
0012 end
0013
0014
0015 if ~isnan(options_structure.highres),
0016 highres=options_structure.highres;
0017 else
0018 highres=0;
0019 end
0020
0021
0022 if ~isnan(options_structure.alpha),
0023 transparency=options_structure.alpha;
0024 else
0025 transparency=1.5;
0026 end
0027
0028
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
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
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
0059 imagesc(xm,ym,image_rgb);set(gca,'YDir','normal');
0060
0061
0062 options_structure.colorbar=0;
0063
0064 applyoptions(md,data,options_structure);
0065
0066
0067 if ~isnan(options_structure.colorbar),
0068
0069
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
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
0098 axis off;
0099
0100
0101 axis equal;