Home > NoiseTools > nt_same_clim.m

nt_same_clim

PURPOSE ^

nt_same_clim(h,clim) - harmonize color limits of plots within figure

SYNOPSIS ^

function clim=nt_same_clim(h, clim)

DESCRIPTION ^

nt_same_clim(h,clim) - harmonize color limits of plots within figure

  h: figure handle [default: current]
  clim: color limits to impose

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function clim=nt_same_clim(h, clim)
0002 %nt_same_clim(h,clim) - harmonize color limits of plots within figure
0003 %
0004 %  h: figure handle [default: current]
0005 %  clim: color limits to impose
0006 
0007 if nargin<1||isempty(h); h=gcf; end
0008 if nargin<2; clim=[]; end
0009 
0010 c=get(h,'children');
0011 
0012 if isempty(clim)
0013     clims=[];
0014     for iC=1:numel(c)    
0015         cc=c(iC);
0016         try
0017             if ~isempty(get(cc,'clim'));
0018                 clims=[clims; (get(cc,'clim'))];
0019             end
0020         end
0021     end
0022     clim=[min(clims(:)),max(clims(:))];
0023 end
0024 
0025 for iC=1:numel(c)    
0026     cc=c(iC);
0027     try
0028         set(cc,'clim',clim);
0029     end
0030 end
0031 
0032

Generated on Sat 29-Apr-2023 17:15:46 by m2html © 2005