0001 function hout = ltpda_msuptitle(str)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 plotregion = .92;
0023
0024
0025 titleypos = .95;
0026
0027
0028
0029
0030 fs = get(gcf,'defaultaxesfontsize');
0031
0032
0033 fudge=1;
0034
0035 haold = gca;
0036 figunits = get(gcf,'units');
0037
0038
0039
0040
0041 if (~strcmp(figunits,'pixels')),
0042 set(gcf,'units','pixels');
0043 pos = get(gcf,'position');
0044 set(gcf,'units',figunits);
0045 else
0046 pos = get(gcf,'position');
0047 end
0048 ff = (fs-4)*1.27*5/pos(4)*fudge;
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063 ch = get(gcf,'children');
0064 h=[];
0065 for i=1:length(ch),
0066 if strcmp(get(ch(i),'type'),'axes'),
0067 h=[h,ch(i)];
0068 end
0069 end
0070
0071
0072 max_y=0;
0073 min_y=1;
0074
0075 oldtitle =0;
0076 for i=1:length(h),
0077 if (~strcmp(get(h(i),'Tag'),'suptitle')),
0078 pos=get(h(i),'pos');
0079 if (pos(2) < min_y), min_y=pos(2)-ff/5*3;end;
0080 if (pos(4)+pos(2) > max_y), max_y=pos(4)+pos(2)+ff/5*2;end;
0081 else
0082 oldtitle = h(i);
0083 end
0084 end
0085
0086 if max_y > plotregion,
0087 scale = (plotregion-min_y)/(max_y-min_y);
0088 for i=1:length(h),
0089 get(h(i),'Tag')
0090 if ~strcmp(get(h(i),'Tag'),'legend')
0091 pos = get(h(i),'position');
0092 pos(2) = (pos(2)-min_y)*scale+min_y;
0093 pos(4) = pos(4)*scale-(1-scale)*ff/5*3;
0094 set(h(i),'position',pos);
0095 end
0096 end
0097 end
0098
0099 np = get(gcf,'nextplot');
0100 set(gcf,'nextplot','add');
0101 if (oldtitle),
0102 delete(oldtitle);
0103 end
0104 ha=axes('pos',[0 1 1 1],'visible','off','Tag','suptitle');
0105 ht=text(.5,titleypos-1,str);set(ht,'horizontalalignment','center','fontsize',fs);
0106 set(gcf,'nextplot',np);
0107 axes(haold);
0108
0109
0110 legH = legend;
0111 if ~isempty(legH)
0112 axes(legH);
0113 end
0114
0115 if nargout,
0116 hout=ht;
0117 end
0118