Changeset 18481


Ignore:
Timestamp:
09/03/14 19:29:49 (11 years ago)
Author:
schlegel
Message:

NEW: add stairs option

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/qmu/plot/plot_hist_norm.m

    r14182 r18481  
    4444%    ymin2         (numeric, minimum of cdf y-axis)
    4545%    ymax2         (numeric, maximum of cdf y-axis)
    46 %    nrmplt        (char, 'line' or 'off' to change nrm plots from 'bar')
     46%    nrmplt        (char, pass 'l' or 'off' to change nrm plots
     47%                   from default of 'bar' or 'b' to 'line' instead,
     48%                   pass 's' to change nrm plot to 'stairs')                                                 
    4749%    cdfplt        (char, 'off' to turn off cdf line plots)
    4850%    cdfleg        (char, 'off' to turn off cdf legends)
     
    174176
    175177%  parameters
    176 
     178LineWidth=1;
    177179while (iarg <= nargin-1)
    178180    if ischar(varargin{iarg})
     
    180182                {'hmin','hmax','hnint',...
    181183                 'ymin1','ymax1','ymin2','ymax2',...
    182                  'nrmplt','EdgeColor','FaceColor','cdfplt','cdfleg','nrmleg','cmap','titleplt','xlabelplt','ylabelplt','FontSize'},...
     184                 'nrmplt','EdgeColor','FaceColor','LineWidth','cdfplt',...
     185                                     'cdfleg','nrmleg','cmap','titleplt','xlabelplt','ylabelplt','FontSize'},...
    183186                'exact'))
    184187            eval([varargin{iarg} '=varargin{iarg+1};']);
     
    251254    hl1(1*ncol+1:2*ncol)=...
    252255        line(edges(1:end-1),dhistc(1:end-1,1*ncol+1:2*ncol),...
    253              'LineWidth',2);
     256             'LineWidth',LineWidth);
     257elseif strncmpi(nrmplt,'s',1)
     258         hl1=stairs(edges(1:end-1)-(hmax-hmin)/hnint/2,dhistc(1:end-1,1:ncol));
    254259elseif strncmpi(nrmplt,'off',3)
    255260    hl1=bar (edges(1:end-1),dhistc(1:end-1,1:1*ncol));
     
    269274
    270275%set face and edge color
    271 for i=1:length(hl1)
    272         set(hl1(i),'EdgeColor',EdgeColor,'FaceColor',FaceColor);
     276if ~strncmpi(nrmplt,'s',1)
     277        for i=1:length(hl1)
     278                set(hl1(i),'EdgeColor',EdgeColor,'FaceColor',FaceColor,'LineWidth',LineWidth);
     279        end
    273280end
    274281
     
    282289cmap=colormap;
    283290for i=1:length(hl1)
    284     if (length(hl1) > 1)
    285         imap=round((i-1)/(length(hl1)-1)*(size(cmap,1)-1))+1;
    286     else
    287         imap=1;
    288     end
    289     if     strcmpi(get(hl1(i),'Type'),'hggroup')
    290         if ischar(get(hl1(i),'FaceColor')) && ...
    291            strcmpi(get(hl1(i),'FaceColor'),'flat')
    292             set(hl1(i),'FaceColor',cmap(imap,:))
    293         else
    294             set(hl1(i),'FaceColor',get(hl1(i),'FaceColor'))
    295         end
    296     elseif strcmpi(get(hl1(i),'Type'),'line')
    297         set(hl1(i),'Color',cmap(imap,:))
    298     end
     291        if (length(hl1) > 1)
     292                imap=round((i-1)/(length(hl1)-1)*(size(cmap,1)-1))+1;
     293        else
     294                imap=1;
     295        end
     296        if ~strncmpi(nrmplt,'s',1) && strcmpi(get(hl1(i),'Type'),'hggroup')
     297                if ischar(get(hl1(i),'FaceColor')) && ...
     298                                strcmpi(get(hl1(i),'FaceColor'),'flat')
     299                        set(hl1(i),'FaceColor',cmap(imap,:))
     300                else
     301                        set(hl1(i),'FaceColor',get(hl1(i),'FaceColor'))
     302                end
     303        elseif strcmpi(get(hl1(i),'Type'),'line')
     304                set(hl1(i),'Color',cmap(imap,:))
     305        elseif strncmpi(nrmplt,'s',1)
     306                set(hl1(i),'Color',EdgeColor,'LineWidth',2)
     307        end
    299308end
    300309
Note: See TracChangeset for help on using the changeset viewer.