supplot.m

来自「KPCA是一种非线性的盲源分离方法」· M 代码 · 共 46 行

M
46
字号
function theAxis = supplot(total,which,border)
%SUPPLOT(n,k) works similar to subplot.  But it will produce
%  k-th of n subplots that are arranged 'evenly' into an array.
%
% STH * 3AUG2001

if nargin == 0,
  total = 1;
  which = 1;
  border = 0;
end

total = total(:);
if sum(size(total) == [2 1])==2
  r = total(1);
  c = total(2);
elseif length(total) == 1
  r  = ceil(sqrt(total));
  c  = ceil(total/r);
else
  error('total must be 2x1 vector or skalar')
end

if ~exist('border') | isempty(border),
  ax = subplot(r,c,which);
else
  if 0>border | border>=0.5,
    error('border must be in the interval [0;0.5[');
  end
  width = 1/c;
  height = 1/r;
  bw = width*border;    % border width
  bh = height*border;   % border height
  left = mod(which-1,c)*width + bw;
  bottom = 1-(floor((which+c-1)/c))/r + bh;
  width = width - 2*bw;
  height = height - 2*bh;
  ax = axes('position',[left,bottom,width,height]);
end

% return identifier, if requested:
if(nargout > 0)
  theAxis = ax;
end

⌨️ 快捷键说明

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