Changeset 2709
- Timestamp:
- 12/08/09 16:16:10 (15 years ago)
- Location:
- issm/trunk/src/m/classes/public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/public/buildoverlaycolorbar.m
r1 r2709 1 function colorbar_rgb=buildoverlaycolorbar(md, field,transparency);1 function colorbar_rgb=buildoverlaycolorbar(md,data,transparency); 2 2 %BUILDOVERLAYCOLORBAR - creates the colorbar associated with an averlay plot option 3 3 % … … 6 6 % 7 7 % Usage: 8 % colorbar_rgb=buildoverlaycolorbar(md, field,transparency);8 % colorbar_rgb=buildoverlaycolorbar(md,data,transparency); 9 9 % 10 10 % Example: … … 14 14 15 15 %recover results 16 if isfield(struct(md),field) 17 data=eval(['md.' field ';']); 18 else 19 data=field; 20 end 21 22 results=min(data):(max(data)-min(data))/256:max(data); 16 results=max(1.5,min(data)):(max(data)-min(data))/256:max(data); 23 17 24 18 %Build hsv color image from radar and results … … 28 22 %hue 29 23 %cut results under 1.5, and log 30 results(find(results<1.5))=1.5;24 %results(find(results<1.5))=1.5; 31 25 h=bytscl((results))/(255+1); %1 offset on colormap 32 26 -
issm/trunk/src/m/classes/public/plot/plot_overlay.m
r2700 r2709 124 124 set(colorbar_image_handle,'CData',colorbar_rgb); 125 125 set(colorbar_handle,'Position',getfieldvalue(options,'colorbarpos')); 126 set(colorbar_handle,'FontSize',getfieldvalue(options,'fontsize',14)); 126 127 127 128 %modify ticks. 128 data(find(data<1.5))=1.5;129 129 scalestring=get(colorbar_handle,'YTickLabel'); 130 scalevalues=get(colorbar_handle,'YTick'); 131 scaleminmax=caxis; 132 numvalues=length(scalevalues); 130 numvalues=length(get(colorbar_handle,'YTick')); 133 131 134 132 scalestring=[]; 133 scaleminmax=[max(min(data),1.5) max(data)]; 135 134 for i=1:numvalues, 136 fraction=( scalevalues(i)-scaleminmax(1))/(scaleminmax(2)-scaleminmax(1));137 scalevalues(i)=round_ice( exp(min(log(data))+(max(log(data))-min(log(data)))*fraction),2);135 fraction=(i-1)/(numvalues-1); 136 scalevalues(i)=round_ice(scaleminmax(1)+(scaleminmax(2)-scaleminmax(1))*fraction,2); 138 137 scalestring=[scalestring; sprintf('%8.4g',scalevalues(i))]; 139 138 end 140 139 set(colorbar_handle,'YTickLabel',scalestring); 141 140 set(colorbar_handle,'YColor','y'); 142 set(colorbar_handle,'FontSize',getfieldvalue(options,'fontsize',14));143 141 end
Note:
See TracChangeset
for help on using the changeset viewer.