File: computeColor.sci

package info (click to toggle)
scilab-plotlib 0.41-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,196 kB
  • sloc: xml: 3,308; makefile: 15
file content (21 lines) | stat: -rw-r--r-- 496 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function _C=computeColor(h)
   
   ax=h.parent;
   _win=ax.parent;
   
   Cmin=ax.user_data.CLim(1);
   Cmax=ax.user_data.CLim(2);

   activateRGBColormap(_win)
   Colormaptable=_win.user_data.Colormaptable;
   ncolors=length(Colormaptable);
   
   if h.CDataMapping=='scaled'      
     _C=round((h.CData-Cmin)/(Cmax-Cmin+%eps)*(ncolors-1))+1;
   else
     _C=h.CData;
   end  
   _C(_C<1)=1; _C(_C>ncolors)=ncolors; // treshold the colors
   _C=matrix(Colormaptable(_C),size(_C));

endfunction