Index: trunk/src/plot_field.m
===================================================================
--- trunk/src/plot_field.m	(revision 292)
+++ trunk/src/plot_field.m	(revision 294)
@@ -52,6 +52,8 @@
 %   haxes: handle of the plotting axes to update with the new plot. If this input is absent or not a valid axes handle, a new figure is created.
 %
-%   PlotParam: parameters for plotting, as read on the uvmat or view_field interface (by function 'read_GUI.m')
-%     .Coordinates.CheckFixLimits:=0 (default) adjust axes limit to the X,Y data, =1: preserves the previous axes limits
+%   PlotParam: structure containing the parameters for plotting, as read on the uvmat or view_field GUI (by function 'read_GUI.m').
+%      Contains three substructures:
+%     .Coordinates: coordinate parameters:
+%           .CheckFixLimits:=0 (default) adjust axes limit to the X,Y data, =1: preserves the previous axes limits
 %     .Coordinates.CheckFixEqual: =0 (default):automatic adjustment of the graph, keep 1 to 1 aspect ratio for x and y scales. 
 %            --scalars--
@@ -131,7 +133,5 @@
     end
 end
-% if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1)
-%     PlotParam=read_plot_param(PlotParam);   
-% end
+
 % create a new figure and axes if the plotting axes does not exist
 if testnewfig
@@ -176,5 +176,5 @@
     index_0D=find(NbDim==0);
     
-        %% set axes properties
+    %% set axes properties
     if isfield(Coordinates,'CheckFixLimits') && isequal(Coordinates.CheckFixLimits,1)  %adjust the graph limits*
         set(haxes,'XLimMode', 'manual')
@@ -187,7 +187,7 @@
         Coordinates.CheckFixEqual=1;
     end
-    if isfield(Coordinates,'CheckFixEqual') && isequal(Coordinates.CheckFixEqual,1) 
+    if isfield(Coordinates,'CheckFixEqual') && isequal(Coordinates.CheckFixEqual,1)
         set(haxes,'DataAspectRatioMode','manual')
-       set(haxes,'DataAspectRatio',[1 1 1])
+        set(haxes,'DataAspectRatio',[1 1 1])
     else
         set(haxes,'DataAspectRatioMode','auto')%automatic aspect ratio
@@ -222,15 +222,15 @@
 
 if isempty(index_1D)
-     plot_profile([],[],[],haxes);%
+    plot_profile([],[],[],haxes);%
 else
-        Coordinates=plot_profile(Data,CellVarIndex(index_1D),VarType(index_1D),haxes,PlotParam.Coordinates);% 
-        if testzoomaxes
-            [zoomaxes,Coordinates]=plot_profile(Data,CellVarIndex(index_1D),VarType(index_1D),zoomaxes,PlotParam.Coordinates);
-            AxeData.ZoomAxes=zoomaxes;
-        end
-        if ~isempty(Coordinates)
-            PlotParamOut.Coordinates=Coordinates;
-        end
-        PlotType='line';
+    Coordinates=plot_profile(Data,CellVarIndex(index_1D),VarType(index_1D),haxes,Coordinates);%
+    if testzoomaxes
+        [zoomaxes,Coordinates]=plot_profile(Data,CellVarIndex(index_1D),VarType(index_1D),zoomaxes,PlotParam.Coordinates);
+        AxeData.ZoomAxes=zoomaxes;
+    end
+    if ~isempty(Coordinates)
+        PlotParamOut.Coordinates=Coordinates;
+    end
+    PlotType='line';
 end
 htext=findobj(hfig,'Tag','text_display');
@@ -378,6 +378,6 @@
             eval(['data.' VarName '=squeeze(data.' VarName ');'])
             %eval(['min(data.' VarName ')'])
-            eval(['YMin(ivar)=min(min(data.' VarName '));'])
-            eval(['YMax(ivar)=max(max(data.' VarName '));'])
+            YMin(ivar)=min(min(data.(VarName)));
+            YMax(ivar)=max(max(data.(VarName)));
             plotstr=[plotstr 'coord_x{' num2str(icell) '},data.' VarName ',' charplot_0 ','];
             eval(['nbcomponent2=size(data.' VarName ',2);']);
@@ -453,7 +453,7 @@
 
 %% determine axes bounds
-CoordinatesOut.RangeX=[min(XMin) max(XMax)];
-CoordinatesOut.RangeY=[min(YMin_cell) max(YMax_cell)];
-fix_lim=isfield(Coordinates,'FixLimits') && Coordinates.FixLimits;
+%CoordinatesOut.RangeX=[min(XMin) max(XMax)];
+%CoordinatesOut.RangeY=[min(YMin_cell) max(YMax_cell)];
+fix_lim=isfield(Coordinates,'CheckFixLimits') && Coordinates.CheckFixLimits;
 if fix_lim
     if ~isfield(Coordinates,'MinX')||~isfield(Coordinates,'MaxX')||~isfield(Coordinates,'MinY')||~isfield(Coordinates,'MaxY')
@@ -461,5 +461,8 @@
     end 
 end
-if ~fix_lim
+if fix_lim
+    set(haxes,'XLim',[Coordinates.MinX Coordinates.MaxX])
+    set(haxes,'YLim',[Coordinates.MinY Coordinates.MaxY])
+else    
     CoordinatesOut.MinX=min(XMin);
     CoordinatesOut.MaxX=max(XMax);
@@ -550,5 +553,5 @@
                 if test_vec 
                     eval(['vec_F=Data.' Data.ListVarName{ivar_F} ';']) % warning flags for  dubious vectors
-                    if  ~(isfield(PlotParam.Vectors,'HideWarning') && isequal(PlotParam.Vectors.HideWarning,1)) 
+                    if  ~(isfield(PlotParam.Vectors,'CheckHideWarning') && isequal(PlotParam.Vectors.CheckHideWarning,1)) 
                         test_black=1;
                     end
@@ -659,6 +662,8 @@
 %%   image or scalar plot %%%%%%%%%%%%%%%%%%%%%%%%%%
 
-if ~isfield(PlotParam.Scalar,'CheckContours')
-    PlotParam.Scalar.Contours=0; %default
+if isfield(PlotParam.Scalar,'ListContour')
+    CheckContour=strcmp(PlotParam.Scalar.ListContour{1},'contours');
+else
+    CheckContour=0; %default
 end
 PlotParamOut=PlotParam; %default
@@ -683,6 +688,6 @@
     
     %set the color map
-    if isfield(PlotParam.Scalar,'BW')
-        BW=PlotParam.Scalar.BW; %test for BW gray scale images
+    if isfield(PlotParam.Scalar,'CheckBW')
+        BW=PlotParam.Scalar.CheckBW; %test for BW gray scale images
     else
         BW=(siz==2) && (isa(A,'uint8')|| isa(A,'uint16'));% non color images represented in gray scale by default
@@ -691,6 +696,6 @@
     %case of grey level images or contour plot
     if siz==2 
-        if ~isfield(PlotParam.Scalar,'FixScal')
-            PlotParam.Scalar.FixScal=0;%default
+        if ~isfield(PlotParam.Scalar,'CheckFixScalar')
+            PlotParam.Scalar.CheckFixScalar=0;%default
         end
         if ~isfield(PlotParam.Scalar,'MinA')
@@ -701,5 +706,5 @@
         end
         Aline=[];
-        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
+        if ~PlotParam.Scalar.CheckFixScalar ||isempty(PlotParam.Scalar.MinA)||~isa(PlotParam.Scalar.MinA,'double')  %correct if there is no numerical data in edit box
             Aline=reshape(A,1,[]);
             Aline=Aline(~isnan(A));
@@ -709,9 +714,8 @@
             end
             MinA=double(min(Aline));
-            %MinA=double(min(min(A)));
         else
             MinA=PlotParam.Scalar.MinA;
         end; 
-        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
+        if ~PlotParam.Scalar.CheckFixScalar||isempty(PlotParam.Scalar.MaxA)||~isa(PlotParam.Scalar.MaxA,'double') %correct if there is no numerical data in edit box
             if isempty(Aline)
                Aline=reshape(A,1,[]);
@@ -723,5 +727,4 @@
             end
             MaxA=double(max(Aline));
-           % MaxA=double(max(max(A)));
         else
             MaxA=PlotParam.Scalar.MaxA;  
@@ -729,7 +732,6 @@
         PlotParamOut.Scalar.MinA=MinA;
         PlotParamOut.Scalar.MaxA=MaxA;
-        
         % case of contour plot
-        if isequal(PlotParam.Scalar.Contours,1)
+        if CheckContour
             if ~isempty(hima) && ishandle(hima)
                 delete(hima)
@@ -738,5 +740,5 @@
                 PlotParam.Scalar.IncrA=NaN;
             end
-            if isnan(PlotParam.Scalar.IncrA)% | PlotParam.Scalar.AutoScal==0
+            if isempty(PlotParam.Scalar.IncrA)|| isnan(PlotParam.Scalar.IncrA)% | PlotParam.Scalar.AutoScal==0
                 cont=colbartick(MinA,MaxA);
                 intercont=cont(2)-cont(1);%default
@@ -780,5 +782,5 @@
         
         % set  colormap for  image display
-        if ~isequal(PlotParam.Scalar.Contours,1)  
+        if ~CheckContour
             % rescale the grey levels with min and max, put a grey scale colorbar
             B=A;
@@ -804,5 +806,5 @@
     
     % display usual image
-    if ~isequal(PlotParam.Scalar.Contours,1)      
+    if ~CheckContour      
         % interpolate field to increase resolution of image display
         test_interp=1;
@@ -860,5 +862,5 @@
         %YTick=0;%default
         if MaxA>MinA
-            if isequal(PlotParam.Scalar.Contours,1)
+            if CheckContour
                 colbarlim=get(hcol,'YLim');
                 scale_bar=(colbarlim(2)-colbarlim(1))/(abscontmax-abscontmin);                
@@ -866,5 +868,5 @@
                 YTick_scaled=colbarlim(1)+scale_bar*(YTick-abscontmin);
                 set(hcol,'YTick',YTick_scaled);
-            elseif (isfield(PlotParam.Scalar,'BW') && isequal(PlotParam.Scalar.BW,1))||isa(A,'uint8')|| isa(A,'uint16')%images
+            elseif (isfield(PlotParam.Scalar,'CheckBW') && isequal(PlotParam.Scalar.CheckBW,1))||isa(A,'uint8')|| isa(A,'uint16')%images
                 hi=get(hcol,'children');
                 if iscell(hi)%multiple images in colorbar
@@ -913,5 +915,5 @@
     vec_V=reshape(vec_V,1,numel(vec_V));
      MinMaxX=max(vec_X)-min(vec_X);
-    if  isfield(PlotParam.Vectors,'FixVec') && isequal(PlotParam.Vectors.FixVec,1)&& isfield(PlotParam.Vectors,'VecScale')...
+    if  isfield(PlotParam.Vectors,'CheckFixVectors') && isequal(PlotParam.Vectors.CheckFixVectors,1)&& isfield(PlotParam.Vectors,'VecScale')...
                &&~isempty(PlotParam.Vectors.VecScale) && isa(PlotParam.Vectors.VecScale,'double') %fixed vector scale
         scale=PlotParam.Vectors.VecScale;  %impose the length of vector representation
@@ -941,5 +943,5 @@
     
     %decimate by a factor 2 in vector mesh(4 in nbre of vectors)
-    if isfield(PlotParam.Vectors,'decimate4') && isequal(PlotParam.Vectors.decimate4,1)
+    if isfield(PlotParam.Vectors,'CheckDecimate4') && PlotParam.Vectors.CheckDecimate4
         diffy=diff(vec_Y); %difference dy=vec_Y(i+1)-vec_Y(i)
         dy_thresh=max(abs(diffy))/2; 
@@ -977,13 +979,10 @@
             col_vec(vec_F~=1 & vec_F~=0 & vec_FF==0)=nbcolor;
        else
-           % ind_flag=find(vec_F~=1 & vec_F~=0);
             col_vec(vec_F~=1 & vec_F~=0)=nbcolor;
        end
-      % col_vec(ind_flag)=nbcolor;    
     end
     nbcolor=nbcolor+1;
     if ~isempty(ivar_FF)
-        %ind_flag=find(vec_FF~=0);
-        if isfield(PlotParam.Vectors,'HideFalse') && PlotParam.Vectors.HideFalse==1
+        if isfield(PlotParam.Vectors,'CheckHideFalse') && PlotParam.Vectors.CheckHideFalse==1
             colorlist(nbcolor,:)=[NaN NaN NaN];% no plot of false vectors
         else
@@ -1015,5 +1014,5 @@
     YMin=[];
     YMax=[];
-    fix_lim=isfield(PlotParam,'FixLimits') && PlotParam.FixLimits;
+    fix_lim=isfield(PlotParam,'CheckFixLimits') && PlotParam.CheckFixLimits;
     if fix_lim
         if ~isfield(PlotParam,'MinX')||~isfield(PlotParam,'MaxX')||~isfield(PlotParam,'MinY')||~isfield(PlotParam,'MaxY')
