Mercurial > hg > octave-lyh
comparison scripts/plot/spinmap.m @ 7163:d4d8c7b33e16
[project @ 2007-11-12 21:54:07 by jwe]
author | jwe |
---|---|
date | Mon, 12 Nov 2007 21:54:08 +0000 |
parents | |
children | 2b5e6c0a9df9 |
comparison
equal
deleted
inserted
replaced
7162:f2ba4aa9a5f9 | 7163:d4d8c7b33e16 |
---|---|
1 ## Copyright (C) 2007 Kai Habel | |
2 ## | |
3 ## This program is free software; you can redistribute it and/or modify it | |
4 ## under the terms of the GNU General Public License as published by | |
5 ## the Free Software Foundation; either version 2, or (at your option) | |
6 ## any later version. | |
7 ## | |
8 ## OctPlot is distributed in the hope that it will be useful, but | |
9 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
11 ## General Public License for more details. | |
12 ## | |
13 ## You should have received a copy of the GNU General Public License | |
14 ## along with OctPlot; see the file COPYING. If not, write to the Free | |
15 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA | |
16 ## 02111-1307, USA. | |
17 | |
18 ## -*- texinfo -*- | |
19 ## @deftypefn {Function File} spinmap (@var{T}, @var{inc}) | |
20 ## @deftypefnx {Function File} spinmap (@var{T}) | |
21 ## @deftypefnx {Function File} spinmap () | |
22 ## Cycles the colormap for @var{T} seconds with an increment | |
23 ## of @var{inc}. Both parameter are optional. In that case 5s and an increment | |
24 ## of 2 is taken. | |
25 ## A higher @var{inc} causes a faster cycle through the colormap. | |
26 ## @end deftypefn | |
27 ## @seealso{gca, colorbar} | |
28 | |
29 ## Author: Kai Habel <kai.habel at gmx.de> | |
30 | |
31 function spinmap(T, inc) | |
32 | |
33 if (nargin == 0) | |
34 inc = 2; | |
35 T = 5; | |
36 elseif (nargin == 1) | |
37 inc = 2; | |
38 endif | |
39 | |
40 cmap = get(gcf,"Colormap"); | |
41 clen = rows(cmap); | |
42 | |
43 t0 = clock; | |
44 | |
45 while (etime(clock, t0) < T) | |
46 for n = 1 : inc : clen | |
47 newmap = shift(cmap, n, 1); | |
48 set(gcf,"Colormap",newmap) | |
49 drawnow | |
50 endfor | |
51 end | |
52 set(gcf,"Colormap",cmap) | |
53 end |