Changeset 192 for trunk/src/plot_field.m
- Timestamp:
- Feb 14, 2011, 7:03:10 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plot_field.m
r191 r192 128 128 end 129 129 end 130 if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1)131 PlotParam=read_plot_param(PlotParam);132 end130 % if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1) 131 % PlotParam=read_plot_param(PlotParam); 132 % end 133 133 % create a new figure and axes if the plotting axes does not exist 134 134 if testnewfig 135 135 hfig=figure; 136 if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1)137 set(hfig,'UserData',PlotParam)138 end136 % if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1) 137 % set(hfig,'UserData',PlotParam) 138 % end 139 139 set(hfig,'Units','normalized') 140 set(hfig,'WindowButtonDownFcn','mouse_down')141 set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action function142 set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse action function140 % set(hfig,'WindowButtonDownFcn','mouse_down') 141 % set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action function 142 % set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse action function 143 143 haxes=axes; 144 144 set(haxes,'position',[0.13,0.2,0.775,0.73]) … … 146 146 else 147 147 hfig=get(haxes,'parent'); 148 set(0,'CurrentFigure',hfig) 149 set(hfig,'CurrentAxes',haxes) 148 set(0,'CurrentFigure',hfig)% the parent of haxes becomes the current figure 149 set(hfig,'CurrentAxes',haxes)% haxes becomes the current axes of the parent figure 150 150 end 151 151 … … 153 153 if ~isempty(Data) 154 154 [Data,errormsg]=check_field_structure(Data); 155 156 155 if ~isempty(errormsg) 157 156 msgbox_uvmat('ERROR',['input of plot_field/check_field_structure: ' errormsg]) … … 213 212 PlotType='line'; 214 213 end 214 215 215 if isempty(index_2D) 216 216 plot_plane([],[],[],haxes);%removes images or vector plots if any … … 330 330 function PlotParamOut=plot_profile(data,CellVarIndex,VarType,haxes,PlotParam) 331 331 %------------------------------------------------------------------- 332 if ~exist('PlotParam','var') 333 PlotParam=[]; 334 end 332 335 PlotParamOut=PlotParam; %default 333 336 hfig=get(haxes,'parent'); … … 1030 1033 1031 1034 %store the coordinate extrema occupied by the field 1035 Data 1032 1036 if ~isempty(Data) 1033 test_lim=0; 1034 if test_vec 1035 Xlim=[min(vec_X) max(vec_X)]; 1036 Ylim=[min(vec_Y) max(vec_Y)]; 1037 test_lim=1; 1037 fix_lim=isfield(PlotParam,'FixLimits') && PlotParam.FixLimits; 1038 if fix_lim 1039 if ~isfield(PlotParam,'MinX')||~isfield(PlotParam,'MaxX')||~isfield(PlotParam,'MinY')||~isfield(PlotParam,'MaxY') 1040 fix_lim=0; %free limits if lits are not set, 1041 end %else PlotParamOut.XMin =PlotParam.XMin... 1042 end 1043 'TESTfix' 1044 fix_lim 1045 if ~fix_lim 1046 XMin=[]; 1047 XMax=[]; 1048 YMin=[]; 1049 YMax=[]; 1038 1050 if test_ima%both background image and vectors coexist, take the wider bound 1039 Xlim(1)=min(AX(1),Xlim(1)); 1040 Xlim(2)=max(AX(end),Xlim(2)); 1041 Ylim(1)=min(AY(end),Ylim(1)); 1042 Ylim(2)=max(AY(1),Ylim(2)); 1043 end 1044 elseif test_ima %only image plot 1045 Xlim(1)=min(AX(1),AX(end)); 1046 Xlim(2)=max(AX(1),AX(end)); 1047 Ylim(1)=min(AY(1),AY(end)); 1048 Ylim(2)=max(AY(1),AY(end)); 1049 test_lim=1; 1050 end 1051 AxeData.RangeX=Xlim; 1052 AxeData.RangeY=Ylim; 1053 1054 % adjust the size of the plot to include the whole field, except if PlotParam.FixedLimits=1 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 1068 set(haxes,'YDir','normal') 1051 XMin=min(AX); 1052 XMax=max(AX); 1053 YMin=min(AY); 1054 YMax=max(AY); 1055 end 1056 if test_vec 1057 XMin=[XMin min(vec_X)]; 1058 XMax=[XMax max(vec_X)]; 1059 YMin=[YMin min(vec_Y)]; 1060 YMax=[YMax max(vec_Y)]; 1061 end 1062 PlotParamOut.MinX=min(XMin); 1063 PlotParamOut.MaxX=max(XMax); 1064 PlotParamOut.MinY=min(YMin); 1065 PlotParamOut.MaxY=max(YMax); 1066 if XMax>XMin 1067 set(haxes,'XLim',[XMin XMax]);% set x limits of frame in axes coordinates 1068 end 1069 if YMax>YMin 1070 set(haxes,'YLim',[YMin YMax]);% set x limits of frame in axes coordinates 1071 end 1072 end 1073 % if Ylim(2)>Ylim(1) 1074 % set(haxes,'YLim',Ylim);% set y limits of frame in axes coordinate 1075 % end 1076 % end 1077 % adjust the size of the plot to include the whole field, except if PlotParam.FixLimits=1 1078 % if ~(isfield(PlotParam,'FixLimits') && PlotParam.FixLimits) && test_lim 1079 % PlotParamOut.MinX=Xlim(1); 1080 % PlotParamOut.MaxX=Xlim(2); 1081 % PlotParamOut.MinY=Ylim(1); 1082 % PlotParamOut.MaxY=Ylim(2); 1083 % if Xlim(2)>Xlim(1) 1084 % set(haxes,'XLim',Xlim);% set x limits of frame in axes coordinates 1085 % end 1086 % if Ylim(2)>Ylim(1) 1087 % set(haxes,'YLim',Ylim);% set y limits of frame in axes coordinate 1088 % end 1089 % end 1090 1091 set(haxes,'YDir','normal') 1069 1092 set(get(haxes,'XLabel'),'String',[XName ' (' x_units ')']); 1070 1093 set(get(haxes,'YLabel'),'String',[YName ' (' y_units ')']);
Note: See TracChangeset
for help on using the changeset viewer.