Changeset 210 for trunk/src/plot_field.m


Ignore:
Timestamp:
Feb 28, 2011, 11:29:08 PM (14 years ago)
Author:
sommeria
Message:

correction bug for vector plot (Fixscale did not work), extensions for 3D fields

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plot_field.m

    r206 r210  
    241241end
    242242if isfield(PlotParamOut,'MinX')
    243 set(haxes,'XLim',[PlotParamOut.MinX PlotParamOut.MaxX])
    244 set(haxes,'YLim',[PlotParamOut.MinY PlotParamOut.MaxY])
     243    set(haxes,'XLim',[PlotParamOut.MinX PlotParamOut.MaxX])
     244    set(haxes,'YLim',[PlotParamOut.MinY PlotParamOut.MaxY])
     245    AxeData.RangeX=[PlotParamOut.MinX PlotParamOut.MaxX];
     246    AxeData.RangeY=[PlotParamOut.MinY PlotParamOut.MaxY];
    245247end
    246248
     
    522524function [haxes,PlotParamOut,PlotType,errormsg]=plot_plane(Data,CellVarIndex,VarTypeCell,haxes,PlotParam,PosColorbar)
    523525%-------------------------------------------------------------------
    524 
    525526grid(haxes, 'off')
    526527%default plotting parameters
     
    756757            Aline=Aline(~isnan(A));
    757758            if isempty(Aline)
    758                  errormsg=['NaN input scalar or image in plot_field'];
     759                 errormsg='NaN input scalar or image in plot_field';
    759760                return
    760761            end
    761             MinA=double(min(Aline))
     762            MinA=double(min(Aline));
    762763            %MinA=double(min(min(A)));
    763764        else
     
    769770               Aline=Aline(~isnan(A));
    770771               if isempty(Aline)
    771                  errormsg=['NaN input scalar or image in plot_field'];
     772                 errormsg='NaN input scalar or image in plot_field';
    772773                return
    773774               end
    774775            end
    775             MaxA=double(max(Aline))
     776            MaxA=double(max(Aline));
    776777           % MaxA=double(max(max(A)));
    777778        else
     
    969970    vec_V=reshape(vec_V,1,numel(vec_V));
    970971     MinMaxX=max(vec_X)-min(vec_X);
    971     if  ~isfield(PlotParam.Vectors,'AutoVec') || isequal(PlotParam.Vectors.AutoVec,0)|| ~isfield(PlotParam.Vectors,'VecScale')...
    972                ||isempty(PlotParam.Vectors.VecScale)||~isa(PlotParam.Vectors.VecScale,'double') %automatic vector scale
    973 %         scale=[];
    974         if test_false %remove false vectors
    975             %indsel=find(AxeData.FF==0);%indsel =indices of good vectors
    976         else     
     972    if  isfield(PlotParam.Vectors,'FixVec') && isequal(PlotParam.Vectors.FixVec,1)&& isfield(PlotParam.Vectors,'VecScale')...
     973               &&~isempty(PlotParam.Vectors.VecScale) && isa(PlotParam.Vectors.VecScale,'double') %fixed vector scale
     974        scale=PlotParam.Vectors.VecScale;  %impose the length of vector representation
     975    else
     976        if ~test_false %remove false vectors   
    977977            indsel=1:numel(vec_X);%
    978978        end
     
    990990            PlotParam.Vectors.VecScale=scale;%update the 'scale' display
    991991        end
    992     else
    993         scale=PlotParam.Vectors.VecScale;  %impose the length of vector representation
    994     end;
     992    end
    995993   
    996994    %record vectors on the plotting axes
     
    10331031       colorlist(nbcolor,:)=[0 0 0]; %add black to the list of colors
    10341032       if ~isempty(ivar_FF)
    1035             ind_flag=find(vec_F~=1 & vec_F~=0 & vec_FF==0);  %flag warning but not false
     1033          %  ind_flag=find(vec_F~=1 & vec_F~=0 & vec_FF==0);  %flag warning but not false
     1034            col_vec(vec_F~=1 & vec_F~=0 & vec_FF==0)=nbcolor;
    10361035       else
    1037             ind_flag=find(vec_F~=1 & vec_F~=0);
     1036           % ind_flag=find(vec_F~=1 & vec_F~=0);
     1037            col_vec(vec_F~=1 & vec_F~=0)=nbcolor;
    10381038       end
    1039       col_vec(ind_flag)=nbcolor;   
     1039      % col_vec(ind_flag)=nbcolor;   
    10401040    end
    10411041    nbcolor=nbcolor+1;
    10421042    if ~isempty(ivar_FF)
    1043         ind_flag=find(vec_FF~=0);
     1043        %ind_flag=find(vec_FF~=0);
    10441044        if isfield(PlotParam.Vectors,'HideFalse') && PlotParam.Vectors.HideFalse==1
    10451045            colorlist(nbcolor,:)=[NaN NaN NaN];% no plot of false vectors
     
    10471047            colorlist(nbcolor,:)=[1 0 1];% magenta color
    10481048        end
    1049         col_vec(ind_flag)=nbcolor;
     1049        col_vec(vec_FF~=0)=nbcolor;
    10501050    end
    10511051    %plot vectors:
Note: See TracChangeset for help on using the changeset viewer.