Changeset 6638


Ignore:
Timestamp:
11/23/10 07:56:48 (14 years ago)
Author:
Mathieu Morlighem
Message:

Added redblue colormap support for overlay

Location:
issm/trunk/src/m/model/plot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/model/plot/applyoptions.m

    r6624 r6638  
    117117                c = c (32:end,:);
    118118        elseif strcmpi(cname,'redblue'),
    119                 m = 30;
    120                 n = fix(0.5*m);
    121                 r = [(0:1:n-1)/n,ones(1,n)];
    122                 g = [(0:n-1)/n, (n-1:-1:0)/n];
    123                 b = [ones(1,n),(n-1:-1:0)/n];
    124                 c = [r(:), g(:), b(:)];
     119                %m = 30;
     120                %n = fix(0.5*m);
     121                %r = [(0:1:n-1)/n,ones(1,n)];
     122                %g = [(0:n-1)/n, (n-1:-1:0)/n];
     123                %b = [ones(1,n),(n-1:-1:0)/n];
     124                %c = [r(:), g(:), b(:)];
     125
     126                c = hsv(64);
     127                c = rgb2hsv(c);
     128                c(:,2) = max(min( abs(c(:,1)-0.5)/0.5 ,1),0);
     129                c(1:32,1)   = 0.7;
     130                c(33:end,1) = 1;
     131                c = hsv2rgb(c);
     132
    125133        elseif strcmpi(cname,'Rignot'),
    126134                c = hsv;
  • issm/trunk/src/m/model/plot/plot_overlay.m

    r6625 r6638  
    5959transparency=getfieldvalue(options,'alpha',1);
    6060data_grid(data_nan)=data_min;
    61 %hue (H)
    62 h_data=(data_grid-data_min)/(data_max-data_min);
    63 %saturation (S)
    64 s_data=max(min((0.1+h_data).^(1/transparency),1),0);
     61
     62colorm=getfieldvalue(options,'colormap','Rignot');
     63if strcmpi(colorm,'Rignot'),
     64        %hue (H)
     65        h_data=(data_grid-data_min)/(data_max-data_min);
     66        %saturation (S)
     67        s_data=max(min((0.1+h_data).^(1/transparency),1),0);
     68elseif strcmpi(colorm,'redblue')
     69        data_mean=data_min+(data_max-data_min)/2;
     70        %hue (H)
     71        h_data=0.7*ones(size(data_grid));
     72        h_data(find(data_grid>data_mean))=1;
     73        %saturation (S)
     74        s_data=max(min(abs(data_grid-data_mean)/(data_max-data_mean) ,1),0);
     75else
     76        error('colormap not supported yet. (''Rignot'' and ''redblue'' are the only cupported colormaps)');
     77end
     78
     79%Saturation is 0 in NaNs
    6580s_data(data_nan)=0;
    6681%intensity (V)
     
    94109
    95110%Apply options, without colorbar and without grid
    96 options=changefieldvalue(options,'colormap','Rignot');         %We used an HSV colorbar
     111options=changefieldvalue(options,'colormap',colorm);           %We used an HSV colorbar
    97112options=changefieldvalue(options,'caxis',[data_min data_max]); %force caxis so that the colorbar is ready
    98113options=addfielddefault(options,'axis','equal off');           %default axis
Note: See TracChangeset for help on using the changeset viewer.