Mercurial > octave-nkf
comparison scripts/image/colormap.m @ 20565:17e507df10e3
Set the default colormap to 'viridis'
* script/image/colormap.m: set the default colormap
to viridis instead of jet.
author | Carlo de Falco <carlo.defalco@polimi.it> |
---|---|
date | Thu, 01 Oct 2015 17:35:34 +0200 |
parents | 4197fc428c7d |
children | 2480bbcd1333 |
comparison
equal
deleted
inserted
replaced
20564:2e7a09136516 | 20565:17e507df10e3 |
---|---|
35 ## colormap should be an @var{n} row by 3 column matrix. The columns | 35 ## colormap should be an @var{n} row by 3 column matrix. The columns |
36 ## contain red, green, and blue intensities respectively. All entries | 36 ## contain red, green, and blue intensities respectively. All entries |
37 ## must be between 0 and 1 inclusive. The new colormap is returned. | 37 ## must be between 0 and 1 inclusive. The new colormap is returned. |
38 ## | 38 ## |
39 ## @code{colormap ("default")} restores the default colormap (the | 39 ## @code{colormap ("default")} restores the default colormap (the |
40 ## @code{jet} map with 64 entries). The default colormap is returned. | 40 ## @code{virdis} map with 64 entries). The default colormap is returned. |
41 ## | 41 ## |
42 ## The map may also be specified by a string, @qcode{"@var{map_name}"}, where | 42 ## The map may also be specified by a string, @qcode{"@var{map_name}"}, where |
43 ## @var{map_name} is the name of a function that returns a colormap. | 43 ## @var{map_name} is the name of a function that returns a colormap. |
44 ## | 44 ## |
45 ## If the first argument @var{hax} is an axes handle, then the colormap for | 45 ## If the first argument @var{hax} is an axes handle, then the colormap for |
50 ## | 50 ## |
51 ## @code{colormap ("list")} returns a cell array with all of the available | 51 ## @code{colormap ("list")} returns a cell array with all of the available |
52 ## colormaps. The options @qcode{"register"} and @qcode{"unregister"} | 52 ## colormaps. The options @qcode{"register"} and @qcode{"unregister"} |
53 ## add or remove the colormap @var{name} from this list. | 53 ## add or remove the colormap @var{name} from this list. |
54 ## | 54 ## |
55 ## @seealso{jet} | 55 ## @seealso{virdis} |
56 ## @end deftypefn | 56 ## @end deftypefn |
57 | 57 |
58 ## Author: Tony Richardson <arichard@stark.cc.oh.us> | 58 ## Author: Tony Richardson <arichard@stark.cc.oh.us> |
59 ## Created: July 1994 | 59 ## Created: July 1994 |
60 ## Adapted-By: jwe | 60 ## Adapted-By: jwe |
77 | 77 |
78 if (nargin == 1) | 78 if (nargin == 1) |
79 map = varargin{1}; | 79 map = varargin{1}; |
80 if (ischar (map)) | 80 if (ischar (map)) |
81 if (strcmp (map, "default")) | 81 if (strcmp (map, "default")) |
82 map = jet (64); | 82 map = virdis (64); |
83 elseif (strcmp (map, "list")) | 83 elseif (strcmp (map, "list")) |
84 cmap = map_list; | 84 cmap = map_list; |
85 return; | 85 return; |
86 else | 86 else |
87 map = feval (map); | 87 map = feval (map); |
130 | 130 |
131 %!demo | 131 %!demo |
132 %! ## Create an image for displaying a colormap | 132 %! ## Create an image for displaying a colormap |
133 %! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64)); | 133 %! image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64)); |
134 %! axis ([1, 64, 0, 1], "ticy", "xy"); | 134 %! axis ([1, 64, 0, 1], "ticy", "xy"); |
135 %! ## Show 'jet' colormap | 135 %! ## Show 'virdis' colormap |
136 %! colormap (jet (64)); | 136 %! colormap (virdis (64)); |
137 %! title "colormap (jet (64))" | 137 %! title "colormap (virdis (64))" |
138 %! disp ("Press a key to continue"); | 138 %! disp ("Press a key to continue"); |
139 %! pause (); | 139 %! pause (); |
140 %! ## Show 'colorcube' colormap | 140 %! ## Show 'colorcube' colormap |
141 %! colormap (colorcube (64)); | 141 %! colormap (colorcube (64)); |
142 %! title "colormap (colorcube (64))" | 142 %! title "colormap (colorcube (64))" |
150 %! cmap = colormap (); | 150 %! cmap = colormap (); |
151 %! assert (cmap, cmaptst); | 151 %! assert (cmap, cmaptst); |
152 %! cmap = (get (gcf, "colormap")); | 152 %! cmap = (get (gcf, "colormap")); |
153 %! assert (cmap, cmaptst); | 153 %! assert (cmap, cmaptst); |
154 %! colormap ("default"); | 154 %! colormap ("default"); |
155 %! assert (colormap (), jet (64)); | 155 %! assert (colormap (), virdis (64)); |
156 %! colormap ("ocean"); | 156 %! colormap ("ocean"); |
157 %! assert (colormap, ocean (64)); | 157 %! assert (colormap, ocean (64)); |
158 %! unwind_protect_cleanup | 158 %! unwind_protect_cleanup |
159 %! close (hf); | 159 %! close (hf); |
160 %! end_unwind_protect | 160 %! end_unwind_protect |