1function sample_colormap 2%SAMPLE_COLORMAP try a colormap for use in cspy 3% 4% Example: 5% sample_colormap 6% See also: testall 7 8% Copyright 2006-2012, Timothy A. Davis, http://www.suitesparse.com 9 10h = jet (64) ; 11h = h (64:-1:1,:) ; 12h = h (20:end,:) ; 13 14% h = h (17:128,:) ; 15 16% s = sum (jet,2) ; 17% h (:,1) = h (:,1) ./ s ; 18% h (:,2) = h (:,2) ./ s ; 19% h (:,3) = h (:,3) ./ s ; 20 21h (1,:) = [1 1 1] ; % white 22h (2,:) = [1 1 .8] ; % light yellow 23 24% h 25colormap (h) ; 26 27clf 28subplot (5,1,1) ; 29image (1:size(h,1)) ; 30 31h = rgb2hsv (h) ; 32% h (:,3) = linspace (1,0,64) ; 33% h= hsv2rgb (h) ; 34 35subplot (5,1,2) ; plot (h(:,1)) ; axis ([1 64 0 1]) ; ylabel ('red') ; 36subplot (5,1,3) ; plot (h(:,2)) ; axis ([1 64 0 1]) ; ylabel ('green') ; 37subplot (5,1,4) ; plot (h(:,3)) ; axis ([1 64 0 1]) ; ylabel ('blue') ; 38subplot (5,1,5) ; plot (sum(h,2)) ; axis ([1 64 0 3]) ; ylabel ('sum') ; 39 40