You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.0 KiB
37 lines
1.0 KiB
function handle=header(xpos,ypos,string,varargin) |
|
|
|
% HEADER(xpos,ypos,string) Write a text string in a |
|
% specified place on the current figure. |
|
% A bogus set of axes is used - so it's best to call |
|
% this LAST, especially if using SUBPLOT. |
|
% |
|
% By default, the fontsize is 6pt larger than current default, |
|
% and text alignment is center/top. |
|
% |
|
% Required Inputs: |
|
% xpos,ypos the location (0.5,1 is centre top) |
|
% string the input string |
|
% Optional Inputs: |
|
% varargin any TEXT arguments |
|
|
|
h=gca; |
|
fsize=get(h,'FontSize')+6; |
|
|
|
if isempty(xpos), xpos=0.5;, end |
|
if isempty(ypos), ypos=1;, end |
|
|
|
k=find(strncmp(varargin,'fontsiz',7)); |
|
if isempty(k), varargin={varargin{:},'fontsize',fsize};, end |
|
varargin={varargin{:},'horizontalalignment','center','verticalalignment','top'}; |
|
|
|
% Get current axes handle and create big invisible axes |
|
|
|
hnow=get(gcf,'currentaxes'); |
|
|
|
h=axes('Position',[0 0 1 1],'Visible','off'); |
|
puttext(xpos,ypos,string,varargin{:}) |
|
|
|
% Return control to old axes |
|
|
|
set(gcf,'currentaxes',hnow) |
|
if nargout>0, handle=h;, end
|
|
|