Changeset 191 for trunk/src/plot_field.m
- Timestamp:
- Feb 5, 2011, 11:25:38 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plot_field.m
r188 r191 53 53 % 54 54 % PlotParam: parameters for plotting, as read on the uvmat interface (by function 'read_plot_param.m') 55 % .Fix edLimits:=0 (default) adjust axes limit to the X,Y data, =1: preserves the previous axes limits56 % . Auto_xy: =0 (default): kepp 1 to 1 aspect ratio for x and y scales, =1: automatic adjustment of the graph55 % .FixLimits:=0 (default) adjust axes limit to the X,Y data, =1: preserves the previous axes limits 56 % .FixEqual: =0 (default):automatic adjustment of the graph, keep 1 to 1 aspect ratio for x and y scales. 57 57 % --scalars-- 58 58 % .Scalar.MaxA: upper bound (saturation color) for the scalar representation, max(field) by default 59 59 % .Scalar.MinA: lower bound (saturation) for the scalar representation, min(field) by default 60 % .Scalar. AutoScal: =1(default) lower and upper bounds of the scalar representation set to the min and max of the field61 % = 0lower and upper bound imposed by .AMax and .MinA60 % .Scalar.FixScal: =0 (default) lower and upper bounds of the scalar representation set to the min and max of the field 61 % =1 lower and upper bound imposed by .AMax and .MinA 62 62 % .Scalar.BW= 1 black and white representation imposed, =0 by default. 63 63 % .Scalar.Contours= 1: represent scalars by contour plots (Matlab function 'contour'); =0 by default … … 65 65 % -- vectors-- 66 66 % .Vectors.VecScale: scale for the vector representation 67 % .Vectors. AutoVec: =0 (default) automatic length for vector representation, =1: length set by .VecScale67 % .Vectors.FixVec: =0 (default) automatic length for vector representation, =1: length set by .VecScale 68 68 % .Vectors.HideFalse= 0 (default) false vectors represented in magenta, =1: false vectors not represented; 69 69 % .Vectors.HideWarning= 0 (default) vectors marked by warnflag~=0 marked in black, 1: no warning representation; … … 177 177 178 178 %% set axes properties 179 if isfield(PlotParam,'Fix edLimits') && isequal(PlotParam.FixedLimits,1) %adjust the graph limits*179 if isfield(PlotParam,'FixLimits') && isequal(PlotParam.FixLimits,1) %adjust the graph limits* 180 180 set(haxes,'XLimMode', 'manual') 181 181 set(haxes,'YLimMode', 'manual') … … 184 184 set(haxes,'YLimMode', 'auto') 185 185 end 186 if isfield(PlotParam,'Auto_xy') && isequal(PlotParam.Auto_xy,1) 186 if ~isfield(PlotParam,'FixEqual')&& isfield(Data,'CoordUnit') 187 PlotParam.FixEqual=1; 188 end 189 if isfield(PlotParam,'FixEqual') && isequal(PlotParam.FixEqual,1) 190 set(haxes,'DataAspectRatioMode','manual') 191 set(haxes,'DataAspectRatio',[1 1 1]) 192 else 187 193 set(haxes,'DataAspectRatioMode','auto')%automatic aspect ratio 188 else189 set(haxes,'DataAspectRatioMode','manual')190 194 end 191 195 else … … 199 203 errormsg=[]; 200 204 AxeData=get(haxes,'UserData'); 205 if isempty(index_1D) 206 plot_profile([],[],[],haxes);% 207 else 208 PlotParamOut=plot_profile(Data,CellVarIndex(index_1D),VarType(index_1D),haxes,PlotParam);% 209 if testzoomaxes 210 [zoomaxes,PlotParamOut]=plot_profile(Data,CellVarIndex(index_1D),VarType(index_1D),zoomaxes,PlotParam); 211 AxeData.ZoomAxes=zoomaxes; 212 end 213 PlotType='line'; 214 end 201 215 if isempty(index_2D) 202 216 plot_plane([],[],[],haxes);%removes images or vector plots if any … … 209 223 end 210 224 end 211 if isempty(index_1D)212 plot_profile([],[],[],haxes);%213 else214 plot_profile(Data,CellVarIndex(index_1D),VarType(index_1D),haxes,PlotParam);%215 if testzoomaxes216 [zoomaxes,PlotParamOut]=plot_profile(Data,CellVarIndex(index_1D),VarType(index_1D),zoomaxes,PlotParam);217 AxeData.ZoomAxes=zoomaxes;218 end219 PlotType='line';220 end221 225 htext=findobj(hfig,'Tag','text_display'); 222 226 if ~isempty(htext) … … 230 234 if ~isempty(errormsg) 231 235 msgbox_uvmat('ERROR', errormsg) 236 end 237 if isfield(PlotParamOut,'MinX') 238 set(haxes,'XLim',[PlotParamOut.MinX PlotParamOut.MaxX]) 239 set(haxes,'YLim',[PlotParamOut.MinY PlotParamOut.MaxY]) 232 240 end 233 241 … … 320 328 321 329 %------------------------------------------------------------------- 322 function [haxes]=plot_profile(data,CellVarIndex,VarType,haxes,PlotParam)330 function PlotParamOut=plot_profile(data,CellVarIndex,VarType,haxes,PlotParam) 323 331 %------------------------------------------------------------------- 332 PlotParamOut=PlotParam; %default 324 333 hfig=get(haxes,'parent'); 325 334 %suppress existing plot isf empty data … … 504 513 PlotParam.Vectors=[]; 505 514 end 515 506 516 PlotParamOut=PlotParam;%default 507 517 hfig=get(haxes,'parent'); 508 518 hcol=findobj(hfig,'Tag','Colorbar'); %look for colorbar axes 509 519 hima=findobj(haxes,'Tag','ima');% search existing image in the current axes 510 % AxeData=get(haxes,'UserData'); %default511 % if ~isstruct(AxeData)% AxeData must be a structure512 % AxeData=[];513 % end514 % AxeData.NbDim=2;515 % if isfield(Data,'ObjectCoord')516 % AxeData.ObjectCoord=Data.ObjectCoord;517 % end518 520 errormsg=[];%default 519 521 test_ima=0; %default: test for image or map plot … … 720 722 %case of grey level images or contour plot 721 723 if siz==2 722 if ~isfield(PlotParam.Scalar,' AutoScal')723 PlotParam.Scalar. AutoScal=0;%default724 if ~isfield(PlotParam.Scalar,'FixScal') 725 PlotParam.Scalar.FixScal=0;%default 724 726 end 725 727 if ~isfield(PlotParam.Scalar,'MinA') … … 729 731 PlotParam.Scalar.MaxA=[];%default 730 732 end 731 if isequal(PlotParam.Scalar. AutoScal,0)||isempty(PlotParam.Scalar.MinA)||~isa(PlotParam.Scalar.MinA,'double') %correct if there is no numerical data in edit box733 if isequal(PlotParam.Scalar.FixScal,0)||isempty(PlotParam.Scalar.MinA)||~isa(PlotParam.Scalar.MinA,'double') %correct if there is no numerical data in edit box 732 734 MinA=double(min(min(A))); 733 735 else 734 736 MinA=PlotParam.Scalar.MinA; 735 737 end; 736 if isequal(PlotParam.Scalar. AutoScal,0)||isempty(PlotParam.Scalar.MaxA)||~isa(PlotParam.Scalar.MaxA,'double') %correct if there is no numerical data in edit box738 if isequal(PlotParam.Scalar.FixScal,0)||isempty(PlotParam.Scalar.MaxA)||~isa(PlotParam.Scalar.MaxA,'double') %correct if there is no numerical data in edit box 737 739 MaxA=double(max(max(A))); 738 740 else … … 1049 1051 AxeData.RangeX=Xlim; 1050 1052 AxeData.RangeY=Ylim; 1053 1051 1054 % adjust the size of the plot to include the whole field, except if PlotParam.FixedLimits=1 1052 if ~(isfield(PlotParam,'FixedLimits') && PlotParam.FixedLimits) && test_lim 1053 if Xlim(2)>Xlim(1) 1054 set(haxes,'XLim',Xlim);% set x limits of frame in axes coordinates 1055 end 1056 if Ylim(2)>Ylim(1) 1057 set(haxes,'YLim',Ylim);% set y limits of frame in axes coordinate 1058 end 1059 end 1060 if ~(isfield(PlotParam,'Auto_xy') && isequal(PlotParam.Auto_xy,1)) 1061 set(haxes,'DataAspectRatio',[1 1 1]) 1062 end 1055 if ~(isfield(PlotParam,'FixLimits') && PlotParam.FixLimits) && test_lim 1056 PlotParamOut.MinX=Xlim(1); 1057 PlotParamOut.MaxX=Xlim(2); 1058 PlotParamOut.MinY=Ylim(1); 1059 PlotParamOut.MaxY=Ylim(2); 1060 if Xlim(2)>Xlim(1) 1061 set(haxes,'XLim',Xlim);% set x limits of frame in axes coordinates 1062 end 1063 if Ylim(2)>Ylim(1) 1064 set(haxes,'YLim',Ylim);% set y limits of frame in axes coordinate 1065 end 1066 end 1067 1063 1068 set(haxes,'YDir','normal') 1064 1069 set(get(haxes,'XLabel'),'String',[XName ' (' x_units ')']);
Note: See TracChangeset
for help on using the changeset viewer.