⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 supertitle.mht

📁 it is a very essential matlab code.
💻 MHT
字号:
From: <Saved by Windows Internet Explorer 7>
Subject: 
Date: Tue, 12 May 2009 09:58:24 -0700
MIME-Version: 1.0
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://www.mece.ualberta.ca/Courses/mec390/390code/supertitle.m
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252">
<META content=3D"MSHTML 6.00.6000.16825" name=3DGENERATOR></HEAD>
<BODY><PRE>function hout=3Dsupertitle(str)
%SUPERTITLE Puts a title above all subplots.
%       SUPERTITLE('text') adds text to the top of the figure
%       above all subplots (a "super title"). Use this function
%       after all subplot commands.

% Drea Thomas 6/15/95 drea@mathworks.com

% Warning: If the figure or axis units are non-default, this
% will break.

% Parameters used to position the supertitle.

% Amount of the figure window devoted to subplots
plotregion =3D .92;

% Y position of title in normalized coordinates
titleypos  =3D .95;

% Fontsize for supertitle
fs =3D get(gcf,'defaultaxesfontsize')+4;

% Fudge factor to adjust y spacing between subplots
fudge=3D1;

haold =3D gca;
figunits =3D get(gcf,'units');

% Get the (approximate) difference between full height (plot + title
% + xlabel) and bounding rectangle.

        if (~strcmp(figunits,'pixels')),
                set(gcf,'units','pixels');
                pos =3D get(gcf,'position');
                set(gcf,'units',figunits);
        else,
                pos =3D get(gcf,'position');
        end
        ff =3D (fs-4)*1.27*5/pos(4)*fudge;

        % The 5 here reflects about 3 characters of height below
        % an axis and 2 above. 1.27 is pixels per point.

% Determine the bounding rectange for all the plots

% h =3D findobj('Type','axes');  =20

% findobj is a 4.2 thing.. if you don't have 4.2 comment out
% the next line and uncomment the following block.
       =20
h =3D findobj(gcf,'Type','axes');  % Change suggested by Stacy J. Hills

% If you don't have 4.2, use this code instead
%ch =3D get(gcf,'children');
%h=3D[];
%for i=3D1:length(ch),
%  if strcmp(get(ch(i),'type'),'axes'),
%    h=3D[h,ch(i)];
%  end
%end

       =20


max_y=3D0;
min_y=3D1;

oldtitle =3D0;
for i=3D1:length(h),
        if (~strcmp(get(h(i),'Tag'),'suptitle')),
                pos=3Dget(h(i),'pos');
                if (pos(2) &lt; min_y), min_y=3Dpos(2)-ff/5*3;end;
                if (pos(4)+pos(2) &gt; max_y), =
max_y=3Dpos(4)+pos(2)+ff/5*2;end;
        else,
                oldtitle =3D h(i);
        end
end

if max_y &gt; plotregion,
        scale =3D (plotregion-min_y)/(max_y-min_y);
        for i=3D1:length(h),
                pos =3D get(h(i),'position');
                pos(2) =3D (pos(2)-min_y)*scale+min_y;
                pos(4) =3D pos(4)*scale-(1-scale)*ff/5*3;
                set(h(i),'position',pos);
        end
end

np =3D get(gcf,'nextplot');
set(gcf,'nextplot','add');
if (oldtitle),
        delete(oldtitle);
end
ha=3Daxes('pos',[0 1 1 1],'visible','off','Tag','suptitle');
ht=3Dtext(.5,titleypos-1,str);set(ht,'horizontalalignment','center','font=
size',fs);
set(gcf,'nextplot',np);
axes(haold);
if nargout,
        hout=3Dht;
end

</PRE></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -