Ignore:
Timestamp:
May 8, 2021, 11:01:15 PM (3 years ago)
Author:
sommeria
Message:

colormap options introduced

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/set_col_vec.m

    r1093 r1103  
    11%'set_col_vec': % sets the color code for vectors depending on a scalar and input parameters (used for plot_field)
    22%-----------------------------------------------------------------------
    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)
    44%-----------------------------------------------------------------------
    55%OUTPUT
     
    88%minC, maxC: min and max of vec_C
    99%ColCode1, ColCode2: absolute threshold in vec_C corresponding to colcode.ColCode1 and colcode.ColCode2
     10%
    1011%INPUT
    1112% colcode: struture setting the colorcode for vectors
    1213%    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'
    1415%    colcode.CheckFixVecColor =0; thresholds scaling relative to min and max, =1 fixed thresholds
    1516%    colcode.MinVec; min
     
    4243col_vec=ones(size(vec_C));%all vectors at color#1 by default
    4344
    44 if ~isstruct(colcode),colcode=[];end;
     45if ~isstruct(colcode),colcode=[];end
    4546colcode_out=colcode;%default
    4647if isempty(vec_C) || ~isnumeric(vec_C)
     
    5556    colorlist=[0 0 1]; %blue
    5657else
    57     if strcmp(colcode.ColorCode,'black')
     58    if strcmp(colcode.ColorCode,'black')% black vectors
    5859        colorlist(1,:)=[0 0 0];%black
    59     elseif strcmp(colcode.ColorCode,'white')
     60    elseif strcmp(colcode.ColorCode,'white')% white vectors
    6061        colorlist(1,:)=[1 1 1];%white
    6162    else
     
    6465end
    6566
     67%% colored vectors
    6668if check_multicolors
    6769    if (isfield(colcode,'CheckFixVecColor') && isequal(colcode.CheckFixVecColor,1))
     
    9799        end
    98100    else
     101        switch colcode.ColorCode
     102            case '64 colors'
    99103        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);
    101109        indsel=ceil((sizlist(1)/64)*(1:64));
    102110        colorlist(:,1)=colorjet(indsel,1);
    103111        colorlist(:,2)=colorjet(indsel,2);
    104112        colorlist(:,3)=colorjet(indsel,3);
    105         sizlist=size(colorlist);
    106         nblevel=sizlist(1);
     113        nblevel=size(colorlist,1);
    107114        col2_1=maxC-minC;
    108115        col_vec=1+floor(nblevel*(vec_C-minC)/col2_1);
Note: See TracChangeset for help on using the changeset viewer.