Home > atmlab > demos > example_colorbar.m

example_colorbar

PURPOSE ^

EXAMPLE_COLORBAR

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 EXAMPLE_COLORBAR

 Demonstrate how zerowhite and colorbarf can be used to create a
 filled contour plot with correct colorbar.

 2004-04-07 Stefan Buehler

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

example_colorbar.m

SOURCE CODE ^

0001 % EXAMPLE_COLORBAR
0002 %
0003 % Demonstrate how zerowhite and colorbarf can be used to create a
0004 % filled contour plot with correct colorbar.
0005 %
0006 % 2004-04-07 Stefan Buehler
0007 
0008 
0009 z = peaks;
0010 
0011 [cmap,v] = zerowhite( z, [-8 -6 -4 -2 -1 1 2 4 6 8], 'nzp', 0.5 );
0012 
0013 % Another example, with more levels and stronger blacking
0014 % You have sometime to play around with upper and lower limit for color levels.
0015 % Matlab does strange things with the colors!
0016 %[cmap,v] = zerowhite( z, [-8:-2 -1.5:0.5:-0.5 0.5:0.5:1.5 2:8], 'nzp', 0.9 );
0017 
0018 
0019 colormap(cmap);
0020 [cout,H,cf] = contourf(z,v);
0021 clabel(cout,H);
0022 colorbarf(cout,H);
0023 
0024 hold on;
0025 
0026 [c,h] = contour(z,[0 0],'k--');
0027 clabel(c,h);
0028 
0029 hold off;
0030

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005