% H3C demo script %------------------------------------------------------------------------- % created: % us 16-Nov-2005 % modified: % us 28-Nov-2005 09:25:14 %------------------------------------------------------------------------- % create a data set rs=randn('state'); randn('state',100); xy=randn(100000,2); randn('state',rs); bin=-3:.5:3; % ... and subplots np=4; sh=[]; for i=1:np sh(i)=subplot(2,2,i); hist3(xy,'edges',{bin;bin}); axis square; title(sprintf('EXAMPLE %-1d',i)); end set(gcf,'paperorientation','portrait'); %------------------------------------------------------------------------- % create H3C commands % - note: colorbar labels may not always be evenly distributed! % they are recomputed from EXISTING z-levels % based on the number of ticks returned by the % current colorbar template % labels, which are too close to each other are pruned com=cell(np,1); % ... EX1: type H3C(HANDLE,COLORMAP,OPT) com{1,1}={ sh(1) % axis handle jet(32) % rgb values '-r' % reverse final col map '-cb' % colorbar option % - prop/val must be 1xn { 'location','eastoutside',... 'fontsize',10 } }; % ... EX2: type H3C(OPT) com{2,1}={ '-c' % col map option 'bone' % - col function '-n' % col nr option 4 % - 4 cols '-h' % axis handle option sh(2) % - axis handle '-p' % HIST3 drawing option % - prop/val must be 1xn { 'edgecolor',.75*[0 1 1] } '-cb' % colorbar option % - prop/val must be 1xn { 'location','eastoutside',... 'xcolor',[0 0 1],... 'ycolor',[0 0 1],... 'fontsize',10 } }; % ... EX3: type H3C(HANDLE,OPT) com{3,1}={ sh(3) % axis handle '-u' % unique col for each z-level '-c' % col map option pink(16) % - rgb values '-a' % alpha value option .25 % - sets fig renderer to opengl '-cb' % colorbar option }; % ... EX4: type H3C(OPT) com{4,1}={ '-h' % axis handle option sh(4) % - axis handle '-c' % col map option 'autumn' % - col function '-n' % - col nr option 2 % - 2 cols % can be adjusted during run-time [-u] '-u' % unique col for each z-level '-cb' % colorbar option '-p' % HIST3 drawing option % - prop/val must be 1xn { 'edgecolor',[0 0 1],... 'edgealpha',.2 } }; %------------------------------------------------------------------------- % apply commands clear p; for i=1:np disp(sprintf('H3C> figure %-1d',i)); p(i)=h3c(com{i}{:}); end
H3C> figure 1 H3C> figure 2 H3C> figure 3 H3C> unique color mapping : rgb data colorspace : insufficient > interpolate colors : 127 < 16 data : 127 factor : 1 < 1 H3C> figure 4 H3C> unique color mapping : autumn colorspace : recomputed colors : 127 < 2 data : 127 factor : 1 < 1
