Home > vbmeg > functions > tool_box > dynamics_movie > test_fig > basic_tool > cmap_move2.m

cmap_move2

PURPOSE ^

----- colormap for moving signal

SYNOPSIS ^

function cmap = cmap_move(parm)

DESCRIPTION ^

----- colormap for moving signal
   C = cmap_move(parm)
 parm.Nlevel  =  gradation color level
 parm.Nwidth  =  active color region length
 parm.Ncycle  =  cycle length
 parm.Nrepeat =  repeat number of active cycle
 
 parm.active_color =  color map name for active state
 parm.rest_color   =  color name for rest state

 2014-11-10 Masa-aki Sato

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    cmap = cmap_move(parm)
0002 %----- colormap for moving signal
0003 %   C = cmap_move(parm)
0004 % parm.Nlevel  =  gradation color level
0005 % parm.Nwidth  =  active color region length
0006 % parm.Ncycle  =  cycle length
0007 % parm.Nrepeat =  repeat number of active cycle
0008 %
0009 % parm.active_color =  color map name for active state
0010 % parm.rest_color   =  color name for rest state
0011 %
0012 % 2014-11-10 Masa-aki Sato
0013 %
0014 % Copyright (C) 2011, ATR All Rights Reserved.
0015 % License : New BSD License(see VBMEG_LICENSE.txt)
0016 
0017 active_color = rgb_val_get(parm.active_color);
0018 rest_color   = rgb_val_get(parm.rest_color  );
0019 back_color   = rgb_val_get(parm.back_color  );
0020 
0021 
0022 %---- nonlibear map for active color
0023 Ncycle  = parm.Ncycle;
0024 Nrepeat = parm.Nrepeat;
0025 Nlevel  = Ncycle * (Nrepeat + parm.Nback);
0026 Nlevel0 = Ncycle * parm.Nback;
0027 Nback   = Ncycle - parm.Nwidth;
0028 
0029 switch    parm.mode
0030 case     'gradation'
0031 %---- Make base gradation color
0032     cmap = cmap_gradation([active_color; rest_color], Nlevel);
0033 case     'jet'
0034     cmap = jet(Nlevel);
0035 case     'hot'
0036     cmap = hot(Nlevel);
0037 end
0038 
0039 % back color at the bottom
0040 ix_back0 = 1:Nlevel0;
0041 
0042 % repeat back color
0043 ix_back = 1:Nback;
0044 ix_back = repmat(ix_back(:), [1 Nrepeat]) ...
0045         + repmat((0:(Nrepeat-1))*Ncycle, [Nback 1]);
0046 ix_back = ix_back(:) + Nlevel0;
0047 ix_back = [ix_back0(:); ix_back];
0048 
0049 cmap(ix_back,:)  = repmat( back_color ,[length(ix_back), 1]);
0050 %----------------END-----------------
0051 plot_mode=0;
0052 
0053 if plot_mode==0, return; end;
0054 
0055 %----------------Plot-----------------
0056 colorbar_plot(cmap)

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005