Changeset 1103 for trunk/src/set_col_vec.m
- Timestamp:
- May 8, 2021, 11:01:15 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/set_col_vec.m
r1093 r1103 1 1 %'set_col_vec': % sets the color code for vectors depending on a scalar and input parameters (used for plot_field) 2 2 %----------------------------------------------------------------------- 3 %function [colorlist,col_vec,minC,ColCode1,ColCode2,maxC]= colvec(colcode,vec_C)3 %function [colorlist,col_vec,minC,ColCode1,ColCode2,maxC]=set_col_vec(colcode,vec_C) 4 4 %----------------------------------------------------------------------- 5 5 %OUTPUT … … 8 8 %minC, maxC: min and max of vec_C 9 9 %ColCode1, ColCode2: absolute threshold in vec_C corresponding to colcode.ColCode1 and colcode.ColCode2 10 % 10 11 %INPUT 11 12 % colcode: struture setting the colorcode for vectors 12 13 % colcode.CName: 'ima_cor','black','white',... 13 % colcode.ColorCode ='black', 'white', 'rgb','brg', '64 colors' 14 % colcode.ColorCode ='black', 'white', 'rgb','brg', '64 colors','BuYlRd' 14 15 % colcode.CheckFixVecColor =0; thresholds scaling relative to min and max, =1 fixed thresholds 15 16 % colcode.MinVec; min … … 42 43 col_vec=ones(size(vec_C));%all vectors at color#1 by default 43 44 44 if ~isstruct(colcode),colcode=[];end ;45 if ~isstruct(colcode),colcode=[];end 45 46 colcode_out=colcode;%default 46 47 if isempty(vec_C) || ~isnumeric(vec_C) … … 55 56 colorlist=[0 0 1]; %blue 56 57 else 57 if strcmp(colcode.ColorCode,'black') 58 if strcmp(colcode.ColorCode,'black')% black vectors 58 59 colorlist(1,:)=[0 0 0];%black 59 elseif strcmp(colcode.ColorCode,'white') 60 elseif strcmp(colcode.ColorCode,'white')% white vectors 60 61 colorlist(1,:)=[1 1 1];%white 61 62 else … … 64 65 end 65 66 67 %% colored vectors 66 68 if check_multicolors 67 69 if (isfield(colcode,'CheckFixVecColor') && isequal(colcode.CheckFixVecColor,1)) … … 97 99 end 98 100 else 101 switch colcode.ColorCode 102 case '64 colors' 99 103 colorjet=jet;% ususal colormap from blue to red 100 sizlist=size(colorjet); 104 case 'BuYlRd' 105 hh=load('BuYlRd.mat'); 106 colorjet=hh.BuYlRd; 107 end 108 sizlist=size(colorjet,1); 101 109 indsel=ceil((sizlist(1)/64)*(1:64)); 102 110 colorlist(:,1)=colorjet(indsel,1); 103 111 colorlist(:,2)=colorjet(indsel,2); 104 112 colorlist(:,3)=colorjet(indsel,3); 105 sizlist=size(colorlist); 106 nblevel=sizlist(1); 113 nblevel=size(colorlist,1); 107 114 col2_1=maxC-minC; 108 115 col_vec=1+floor(nblevel*(vec_C-minC)/col2_1);
Note: See TracChangeset
for help on using the changeset viewer.