pb_defsubplot.m 1.16 KB
Newer Older
Jesse Heckman's avatar
Jesse Heckman committed
1
2
3
4
5
6
7
8
9
10
11
12
function [n,p] = pb_defsubplot(fig)    
% PB_DEFSUBPLOT
%
% Defines the number of Axes, their orientation in the figure and the
% number of plots per axes
%
% PB_DEFSUBPLOT(FIG) scans figure for number of axes, thier orientation and number of plots.
%
% See also PB_NICEGRAPH

% PBToolbox (2018): JJH: j.heckman@donders.ru.nl

Jesse Heckman's avatar
Jesse Heckman committed
13
14
15
16
17
18
19
20
   figure(fig);
   h = flipud(findobj(gcf,'Type','Axes'));
   n = length(h);

   p = zeros(1,n);

   for i = 1:n
      p(i) =  length(findobj(h(i),'Type','Line')) + ... 
Jesse Heckman's avatar
Jesse Heckman committed
21
      length(findobj(h(i),'Type','FunctionLine')) + ...
Jesse Heckman's avatar
Jesse Heckman committed
22
23
24
      length(findobj(h(i),'Type','Bar')) + ...
      length(findobj(h(i),'Type','Area')) + ...
      length(findobj(h(i),'Type','ErrorBar')) + ...
Jesse Heckman's avatar
Jesse Heckman committed
25
      length(findobj(h(i),'Type','Stem')) + ...
Jesse Heckman's avatar
Jesse Heckman committed
26
27
      length(findobj(h(i),'Type','Histogram'));
   end
Jesse Heckman's avatar
Jesse Heckman committed
28
29
30
31
32
33
34
35
36
end


% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % 
%                                                           %
%       Part of Programmeer Beer Toolbox (PBToolbox)        %
%       Written by: Jesse J. Heckman (2018)                 %
%                                                           %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %