Mercurial > octave-nkf
comparison scripts/image/rgbplot.m @ 15515:4beb3a4bd440
rgbplot.m, cmpermute.m, cmunique.m, ind2rgb.m, imwrite.m: use core iscolormap function
author | Carnë Draug <carandraug+dev@gmail.com> |
---|---|
date | Fri, 12 Oct 2012 23:11:08 +0200 |
parents | e2a14d1b4eaa |
children | 3f1b306e2ba9 |
comparison
equal
deleted
inserted
replaced
15514:8d64e87c00cf | 15515:4beb3a4bd440 |
---|---|
30 | 30 |
31 if (nargin != 1) | 31 if (nargin != 1) |
32 print_usage (); | 32 print_usage (); |
33 endif | 33 endif |
34 | 34 |
35 if (! ismatrix (cmap) || ndims (cmap) != 2 || columns (cmap) != 3) | 35 if (! iscolormap (cmap)) |
36 error ("rgbplot: CMAP must be a matrix of size Nx3"); | 36 error ("rgbplot: CMAP must be a colormap"); |
37 elseif (any (cmap(:) < 0) || any (cmap(:) > 1)) | |
38 error ("rgbplot: CMAP intensities must be in the range [0, 1]"); | |
39 endif | 37 endif |
40 | 38 |
41 plot (cmap(:,1),"r", cmap(:,2),"g", cmap(:,3),"b"); | 39 plot (cmap(:,1),"r", cmap(:,2),"g", cmap(:,3),"b"); |
42 set (gca, 'ytick', 0:0.1:1); | 40 set (gca, 'ytick', 0:0.1:1); |
43 xlabel ("color index"); | 41 xlabel ("color index"); |
50 %! rgbplot (ocean); | 48 %! rgbplot (ocean); |
51 | 49 |
52 %%test input validation | 50 %%test input validation |
53 %!error rgbplot () | 51 %!error rgbplot () |
54 %!error rgbplot (1,2) | 52 %!error rgbplot (1,2) |
55 %!error <CMAP must be a matrix of size Nx3> rgbplot ({0 1 0}) | 53 %!error <CMAP must be a colormap> rgbplot ({0 1 0}) |
56 %!error <CMAP must be a matrix of size Nx3> rgbplot (ones (3,3,3)) | |
57 %!error <CMAP must be a matrix of size Nx3> rgbplot (ones (3,4)) | |
58 %!error <CMAP intensities must be in the range> rgbplot ([0 0 -2]) | |
59 %!error <CMAP intensities must be in the range> rgbplot ([0 0 2]) | |
60 |