Index: /issm/trunk/src/m/qmu/plot/plot_boxplot.m
===================================================================
--- /issm/trunk/src/m/qmu/plot/plot_boxplot.m	(revision 4763)
+++ /issm/trunk/src/m/qmu/plot/plot_boxplot.m	(revision 4763)
@@ -0,0 +1,145 @@
+%
+%  plot a box plot of the responses.
+%
+%  []=plot_boxplot(dresp      ,params)
+%  []=plot_boxplot(dresp,descr,params)
+%  []=plot_boxplot(sampr,descr,params)
+%
+%  where the required input is:
+%    dresp         (structure array, responses)
+%      or
+%    dresp         (structure array, responses)
+%    descr         (cell array, list of response descriptions desired)
+%      or
+%    sampr         (double array, lists of response samples)
+%    descr         (cell array, list of response descriptions)
+%
+%  the required fields of dresp are:
+%    descriptor    (char, description)
+%    sample        (double vector, list of samples)
+%
+%  the optional input is:
+%    params        (string/numeric, parameter names and values)
+%
+%  where the optional parameters are:
+%    ymin          (numeric, minimum of y-axis)
+%    ymax          (numeric, maximum of y-axis)
+%
+%  for each response in the input array, this function plots a
+%  matlab box plot of the list of samples and annotates it
+%  with the description.  the lists of samples need not all be
+%  the same length.
+%
+%  this data would typically be contained in the dakota tabular
+%  output file and read by dakota_out_parse.
+%
+%  "Copyright 2009, by the California Institute of Technology.
+%  ALL RIGHTS RESERVED. United States Government Sponsorship
+%  acknowledged. Any commercial use must be negotiated with
+%  the Office of Technology Transfer at the California Institute
+%  of Technology.  (J. Schiermeier, NTR 47078)
+%
+%  This software may be subject to U.S. export control laws.
+%  By accepting this  software, the user agrees to comply with
+%  all applicable U.S. export laws and regulations. User has the
+%  responsibility to obtain export licenses, or other export
+%  authority as may be required before exporting such information
+%  to foreign countries or providing access to foreign persons."
+%
+function []=plot_boxplot(varargin)
+
+if ~nargin
+    help plot_boxplot
+    return
+end
+
+%%  process input data and assemble into matrices as needed
+
+%  responses
+
+iarg=1;
+if isstruct(varargin{iarg})
+    dresp=varargin{iarg};
+    iarg=iarg+1;
+    
+%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
+    if iarg <= nargin && iscell(varargin{iarg})
+        dresp=struc_desc(dresp,varargin{iarg});
+        iarg=iarg+1;
+    end
+    
+    descr=cell (1,length(dresp));
+    lsamp=zeros(1,length(dresp));
+    for i=1:length(dresp)
+        lsamp(i)=length(dresp(i).sample);
+    end
+    sampr=zeros(max(lsamp),length(dresp));
+    sampr(:,:)=NaN;
+
+    for i=1:length(dresp)
+        descr(i)=cellstr(dresp(i).descriptor);
+        sampr(1:lsamp(i),i)=dresp(i).sample;
+    end
+else
+    sampr=varargin{iarg};
+    iarg=iarg+1;
+    
+    if     iarg <= nargin && iscell(varargin{iarg})
+        descr=varargin{iarg};
+        iarg=iarg+1;
+%     elseif iarg <= nargin && ischar(varargin{iarg})
+%         descr=cellstr(varargin{iarg});
+%         iarg=iarg+1;
+    else
+        descr=cell(1,size(sampr,2));
+    end
+end
+
+for i=1:length(descr)
+    if isempty(descr{i})
+        descr(i)={['resp_' num2str(i)]};
+    end
+end
+
+%  parameters
+
+while (iarg <= nargin-1)
+    if ischar(varargin{iarg})
+        eval([varargin{iarg} '=varargin{iarg+1};']);
+        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
+    else
+        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
+    end
+    iarg=iarg+2;
+end
+    
+%%  draw the plot
+
+%  draw box plot
+
+figure
+boxplot(sampr,'labels',descr,'notch','on')
+ax1=gca;
+
+%  add the annotation
+
+ylim('auto')
+[ylims]=ylim;
+if exist('ymin','var')
+    ylims(1)=ymin;
+end
+if exist('ymax','var')
+    ylims(2)=ymax;
+end
+ylim(ylims)
+
+if (size(sampr,2) == 1)
+    tlabc=descr{1};
+else
+    tlabc='Responses';
+end
+title(['Box Plot of ' tlabc],'Interpreter','none');
+xlabel('Response','Interpreter','none');
+ylabel('Value'   ,'Interpreter','none');
+
+end
Index: /issm/trunk/src/m/qmu/plot/plot_hist_norm.m
===================================================================
--- /issm/trunk/src/m/qmu/plot/plot_hist_norm.m	(revision 4763)
+++ /issm/trunk/src/m/qmu/plot/plot_hist_norm.m	(revision 4763)
@@ -0,0 +1,367 @@
+%
+%  plot a relative histogram and cdf optionally along with
+%  a normal distribution.
+%
+%  []=plot_hist_norm(dresp1      ,dresp2      ,params)
+%  []=plot_hist_norm(dresp1,desc1,dresp2,desc2,params)
+%  []=plot_hist_norm(sampr ,descr,mu,sigma    ,params)
+%
+%  where the required input is:
+%    dresp1        (structure array, responses)
+%      or
+%    dresp1        (structure array, responses)
+%    desc1         (cell array, list of response descriptions desired)
+%      or
+%    sampr         (double array, lists of samples)
+%    descr         (cell array, list of descriptions)
+%
+%  and the optional input is:
+%    dresp2        (structure array, responses)
+%      or
+%    dresp2        (structure array, responses)
+%    desc2         (cell array, list of response descriptions desired)
+%      or
+%    mu            (double vector, means)
+%    sigma         (double vector, standard deviations)
+%
+%  the required fields of dresp1 are:
+%    descriptor    (char, description)
+%    sample        (double vector, list of samples)
+%
+%  and the required fields of dresp2 are:
+%    mean          (double, mean of sample)
+%    stddev        (double, standard deviation of sample)
+%
+%  the optional input is:
+%    params        (string/numeric, parameter names and values)
+%
+%  where the optional parameters are:
+%    hmin          (numeric, minimum for histogram)
+%    hmax          (numeric, maximum for histogram)
+%    hnint         (numeric, number of intervals for histogram)
+%    ymin1         (numeric, minimum of histogram y-axis)
+%    ymax1         (numeric, maximum of histogram y-axis)
+%    ymin2         (numeric, minimum of cdf y-axis)
+%    ymax2         (numeric, maximum of cdf y-axis)
+%    cdfplt        (char, 'off' to turn off cdf line plots)
+%    cdfleg        (char, 'off' to turn off cdf legends)
+%
+%  for each response in the input array, this function
+%  calculates and plots a relative histogram and CDF of the list
+%  of samples, and annotates it with the description.  in
+%  addition, a mean and standard deviation may be supplied or,
+%  if empty, calculated so that a normal distribution and CDF may
+%  be plotted.
+%
+%  dresp1 data would typically be contained in the dakota tabular
+%  output file from a sampling analysis, and dresp2 data would
+%  typically be contained in the dakota output file from a local
+%  sensitivity analysis, both read by dakota_out_parse.
+%
+%  "Copyright 2009, by the California Institute of Technology.
+%  ALL RIGHTS RESERVED. United States Government Sponsorship
+%  acknowledged. Any commercial use must be negotiated with
+%  the Office of Technology Transfer at the California Institute
+%  of Technology.  (J. Schiermeier, NTR 47078)
+%
+%  This software may be subject to U.S. export control laws.
+%  By accepting this  software, the user agrees to comply with
+%  all applicable U.S. export laws and regulations. User has the
+%  responsibility to obtain export licenses, or other export
+%  authority as may be required before exporting such information
+%  to foreign countries or providing access to foreign persons."
+%
+function []=plot_hist_norm(varargin)
+
+if ~nargin
+    help plot_hist_norm
+    return
+end
+
+%%  process input data and assemble into matrices as needed
+
+%  responses for histograms
+
+iarg=1;
+if isstruct(varargin{iarg})
+    dresp1=varargin{iarg};
+    iarg=iarg+1;
+    
+%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
+    if iarg <= nargin && iscell(varargin{iarg})
+        dresp1=struc_desc(dresp1,varargin{iarg});
+        iarg=iarg+1;
+    end
+    
+    descr=cell (1,length(dresp1));
+    lsamp=zeros(1,length(dresp1));
+    for i=1:length(dresp1)
+        lsamp(i)=length(dresp1(i).sample);
+    end
+    sampr=zeros(max(lsamp),length(dresp1));
+    sampr(:,:)=NaN;
+
+    for i=1:length(dresp1)
+        descr(i)=cellstr(dresp1(i).descriptor);
+        sampr(1:lsamp(i),i)=dresp1(i).sample;
+    end
+else
+    sampr=varargin{iarg};
+    iarg=iarg+1;
+    
+    lsamp(1:size(sampr,2))=size(sampr,1);
+
+    if     iarg <= nargin && iscell(varargin{iarg})
+        descr=varargin{iarg};
+        iarg=iarg+1;
+%     elseif iarg <= nargin && ischar(varargin{iarg})
+%         descr=cellstr(varargin{iarg});
+%         iarg=iarg+1;
+    else
+        descr=cell(1:size(sampr,2));
+    end
+end
+
+for i=1:length(descr)
+    if isempty(descr{i})
+        descr(i)={['resp_' num2str(i)]};
+    end
+end
+
+%  responses for normal distributions
+
+if     iarg <= nargin && isstruct(varargin{iarg})
+    dresp2=varargin{iarg};
+    iarg=iarg+1;
+
+%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
+    if iarg <= nargin && iscell(varargin{iarg})
+        dresp2=struc_desc(dresp2,varargin{iarg});
+        iarg=iarg+1;
+    end
+    
+    mu   =zeros(1,length(dresp2));
+    sigma=zeros(1,length(dresp2));
+
+    for i=1:length(dresp2)
+        mu   (i)=dresp2(i).mean;
+        sigma(i)=dresp2(i).stddev;
+    end
+elseif iarg+1 <= nargin && ...
+       isnumeric(varargin{iarg}) && isnumeric(varargin{iarg+1})
+    if ~isempty(varargin{iarg})
+        mu   =varargin{iarg};
+    else
+        mu   =mean(sampr);
+        display('Using calculated means.')
+    end
+    iarg=iarg+1;
+    if ~isempty(varargin{iarg})
+        sigma=varargin{iarg};
+    else
+        sigma=std(sampr);
+        display('Using calculated standard deviations.')
+    end
+    iarg=iarg+1;
+end
+
+%  parameters
+
+while (iarg <= nargin-1)
+    if ischar(varargin{iarg})
+        eval([varargin{iarg} '=varargin{iarg+1};']);
+        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
+    else
+        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
+    end
+    iarg=iarg+2;
+end
+
+%%  generate the intervals
+
+if ~exist('hmin','var')
+    hmin=min(min(sampr));
+end
+if ~exist('hmax','var')
+    hmax=max(max(sampr));
+end
+if ~exist('hnint','var')
+    hnint=50;
+end
+edges=hmin:(hmax-hmin)/hnint:hmax;
+
+%%  generate the histogram counts and make them relative
+
+%  note that for the histc function:
+%  n(k) counts the value x(i) if edges(k) <= x(i) < edges(k+1).
+%  The last bin counts any values of x that match edges(end).
+%  Values outside the values in edges are not counted.
+%  Use -inf and inf in edges to include all non-NaN values.
+
+dhistc=histc(sampr,edges);
+for i=1:size(sampr,2)
+    dbelow(i)  =length(find(sampr(:,i)<edges(  1)))/lsamp(i);
+    dhistc(:,i)=dhistc(:,i)                        /lsamp(i);
+    dabove(i)  =length(find(sampr(:,i)>edges(end)))/lsamp(i);
+end
+
+if exist('mu','var') && exist('sigma','var')
+    ncol=size(sampr,2);
+    for i=1:ncol
+        dbelow(ncol+i)=normcdf(edges(  1),mu(i),sigma(i));
+        dhistc(1:size(dhistc,1)-1,ncol+i)=...
+            normcdf(edges(2:end  ),mu(i),sigma(i))-...
+            normcdf(edges(1:end-1),mu(i),sigma(i));
+        dabove(ncol+i)=norminv(edges(end),mu(i),sigma(i));
+        if exist('descr','var')
+            descr(ncol+i)={[descr{i} ' norm']};
+        end
+    end
+end
+
+%  draw the bar plot
+
+figure
+hl1=bar(edges(1:end-1),dhistc(1:end-1,:));
+ax1=gca;
+
+%  set barseries properties for clarity
+
+if (length(hl1) > 1)
+    for i=1:length(hl1)
+        set(hl1(i),'BarWidth',1,'EdgeColor','none');
+    end
+end
+
+xlim('auto')
+[xlims]=xlim;
+if exist('hmin','var')
+    xlims(1)=edges(1);
+end
+if exist('hmax','var')
+    xlims(2)=edges(end-1);
+end
+xlim(xlims)
+
+ylim('auto')
+[ylims]=ylim;
+if exist('ymin1','var')
+    ylims(1)=ymin1;
+end
+if exist('ymax1','var')
+    ylims(2)=ymax1;
+end
+ylim(ylims)
+
+%  add the annotation
+
+if exist('cdfplt','var') && strcmpi(cdfplt,'off')
+    title('Relative Frequency Histogram')
+else
+    title('Relative Frequency Histogram with CDF')
+end
+xlabel('Interval Edge Value');
+ylabel('Relative Frequency');
+
+if exist('descr','var')
+    hleg1=legend(ax1,descr,'Location','NorthWest',...
+                 'Color','none','Interpreter','none');
+else
+    hleg1=legend(ax1);
+end
+
+%%  generate the cumulative distribution functions
+
+if ~exist('cdfplt','var') || ~strcmpi(cdfplt,'off')
+%     cdf=zeros(size(dhistc));
+%     cdf(1,:)=dhistc(1,:);
+%     for i=2:size(dhistc,1)
+%         cdf(i,:)=cdf(i-1,:)+dhistc(i,:);
+%     end
+    cdf=cumsum(dhistc);
+    for i=1:size(dhistc,2)
+        cdf(:,i)=dbelow(i)+cdf(:,i);
+    end
+    if exist('descr','var')
+        ncol=length(descr);
+        for i=1:ncol
+            cdescr(i)={[descr{i} ' cdf']};
+        end
+    end
+
+%  draw the line plot
+
+%  (see "Using Multiple X- and Y-Axes" and "Overlaying Other
+%  Plots on Bar Graphs", or search on "YAxisLocation right")
+
+%     hold all
+%     hold on
+%     plot(edges,cdf)
+%     plotyy([],[],edges,cdf)
+
+%  ticks from the bar plot will show through on the right side,
+%  so make equal number of ticks for the line plot on right side
+
+    nytick=length(get(ax1,'YTick'));
+%     ylim('auto')
+%     [ylims]=ylim;
+    [ylims]=[0 ceil(max(max(cdf))/0.1-0.1)*0.1];
+    if exist('ymin2','var')
+        ylims(1)=ymin2;
+    end
+    if exist('ymax2','var')
+        ylims(2)=ymax2;
+    else
+        ylims(2)=ylims(1)+(nytick-1)/(nytick-1-1)*(ylims(2)-ylims(1));
+    end
+%     ylim(ylims)
+    ytinc =(ylims(2)-ylims(1))/(nytick-1);
+
+    ax2=axes('Position',get(ax1,'Position'),...
+             'XLim',get(ax1,'XLim'),...
+             'XTick',get(ax1,'XTick'),...
+             'YLim',ylims,...
+             'YTick',[ylims(1):ytinc:ylims(2)],...
+             'XAxisLocation','bottom','YAxisLocation','right',...
+             'Color','none','Layer','top');
+    hl2=line(edges(1:end-1),cdf(1:end-1,:),'Parent',ax2);
+
+%  set line property colors to match barseries property
+%  (if barseries is "flat", must interpolate and round to colormap)
+
+    cmap=colormap;
+    for i=1:length(hl2)
+        if ischar(get(hl1(i),'FaceColor')) && ...
+           strcmpi(get(hl1(i),'FaceColor'),'flat')
+            if (length(hl2) > 1)
+                imap=round((i-1)/(length(hl2)-1)*(size(cmap,1)-1))+1;
+            else
+                imap=1;
+            end
+            set(hl2(i),'Color',cmap(imap,:))
+        else
+            set(hl2(i),'Color',get(hl1(i),'FaceColor'))
+        end
+    end
+
+%  add the annotation
+
+    ylabel('Cumulative Percent');
+
+    if ~exist('cdfleg','var') || ~strcmpi(cdfleg,'off')
+% legend doesn't combine with bar chart above
+        if exist('cdescr','var')
+            hleg2=legend(ax2,cdescr,'Location','NorthEast',...
+                         'Color','none','Interpreter','none');
+%             set(hleg2,'Color','white')
+        else
+            hleg2=legend(ax2);
+%             set(hleg2,'Color','white')
+        end
+    end
+
+    set(gcf,'PaperPositionMode','auto')
+%     hold off
+end
+
+end
Index: /issm/trunk/src/m/qmu/plot/plot_hist_norm_ci.m
===================================================================
--- /issm/trunk/src/m/qmu/plot/plot_hist_norm_ci.m	(revision 4763)
+++ /issm/trunk/src/m/qmu/plot/plot_hist_norm_ci.m	(revision 4763)
@@ -0,0 +1,455 @@
+%
+%  plot a relative histogram and cdf optionally along with a
+%  normal distribution for the sample and confidence intervals.
+%
+%  []=plot_hist_norm_ci(dresp      ,params)
+%  []=plot_hist_norm_ci(dresp,descr,params)
+%  []=plot_hist_norm_ci(sampr,descr,params)
+%
+%  where the required input is:
+%    dresp         (structure array, responses)
+%      or
+%    dresp         (structure array, responses)
+%    descr         (cell array, list of response descriptions desired)
+%      or
+%    sampr         (double array, lists of samples)
+%    descr         (cell array, list of descriptions)
+%
+%  the required fields of dresp are:
+%    descriptor    (char, description)
+%    sample        (double vector, list of samples)
+%
+%  and the optional fields of dresp are:
+%    mean          (double, mean of sample)
+%    stddev        (double, standard deviation of sample)
+%    meanci(2)     (double, confidence interval of mean)
+%    stddevci(2)   (double, confidence interval of standard deviation)
+%
+%  the optional input is:
+%    params        (string/numeric, parameter names and values)
+%
+%  and the optional input is:
+%    hmin          (numeric, minimum for histogram)
+%    hmax          (numeric, maximum for histogram)
+%    hnint         (numeric, number of intervals for histogram)
+%    ymin1         (numeric, minimum of histogram y-axis)
+%    ymax1         (numeric, maximum of histogram y-axis)
+%    ymin2         (numeric, minimum of cdf y-axis)
+%    ymax2         (numeric, maximum of cdf y-axis)
+%    nrmplt        (char, 'line' or 'off' to change nrm plots from 'bar')
+%    ciplt         (char, 'line' or 'off' to change ci plots from 'bar')
+%    cdfplt        (char, 'off' to turn off cdf line plots)
+%    cdfleg        (char, 'off' to turn off cdf legends)
+%    cmap          (char or numeric, colormap definition)
+%
+%  for each response in the input array, this function
+%  calculates and plots a relative histogram and CDF of the list
+%  of samples, and annotates it with the description.  in
+%  addition, the normal distribution and CDF are plotted, and
+%  four CDF's are plotted for the confidence intervals.
+%
+%  dresp data would typically be contained in the dakota tabular
+%  output file from a sampling analysis, read by dakota_out_parse.
+%
+%  "Copyright 2009, by the California Institute of Technology.
+%  ALL RIGHTS RESERVED. United States Government Sponsorship
+%  acknowledged. Any commercial use must be negotiated with
+%  the Office of Technology Transfer at the California Institute
+%  of Technology.  (J. Schiermeier, NTR 47078)
+%
+%  This software may be subject to U.S. export control laws.
+%  By accepting this  software, the user agrees to comply with
+%  all applicable U.S. export laws and regulations. User has the
+%  responsibility to obtain export licenses, or other export
+%  authority as may be required before exporting such information
+%  to foreign countries or providing access to foreign persons."
+%
+function []=plot_hist_norm_ci(varargin)
+
+if ~nargin
+    help plot_hist_norm_ci
+    return
+end
+
+%%  process input data and assemble into matrices as needed
+
+iarg=1;
+if isstruct(varargin{iarg})
+    dresp=varargin{iarg};
+    iarg=iarg+1;
+    
+%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
+    if iarg <= nargin && iscell(varargin{iarg})
+        dresp=struc_desc(dresp,varargin{iarg});
+        iarg=iarg+1;
+    end
+    
+    descr=cell (1,length(dresp));
+    lsamp=zeros(1,length(dresp));
+    for i=1:length(dresp)
+        lsamp(i)=length(dresp(i).sample);
+    end
+    sampr=zeros(max(lsamp),length(dresp));
+    sampr(:,:)=NaN;
+    
+    mu     =zeros(1,length(dresp));
+    sigma  =zeros(1,length(dresp));
+    muci   =zeros(2,length(dresp));
+    sigmaci=zeros(2,length(dresp));
+
+    for i=1:length(dresp)
+        descr(i)=cellstr(dresp(i).descriptor);
+        sampr(1:lsamp(i),i)=dresp(i).sample;
+        mu     (i)  =dresp(i).mean;
+        sigma  (i)  =dresp(i).stddev;
+        muci   (:,i)=dresp(i).meanci;
+        sigmaci(:,i)=dresp(i).stddevci;
+    end
+else
+    sampr=varargin{iarg};
+    iarg=iarg+1;
+    
+    lsamp(1:size(sampr,2))=size(sampr,1);
+
+    if     iarg <= nargin && iscell(varargin{iarg})
+        descr=varargin{iarg};
+        iarg=iarg+1;
+%     elseif iarg <= nargin && ischar(varargin{iarg})
+%         descr=cellstr(varargin{iarg});
+%         iarg=iarg+1;
+    else
+        descr=cell(1,size(sampr,2));
+    end
+    
+    mu     =zeros(1,size(sampr,2));
+    sigma  =zeros(1,size(sampr,2));
+    muci   =zeros(2,size(sampr,2));
+    sigmaci=zeros(2,size(sampr,2));
+    for i=1:size(sampr,2)
+%  calculate 95% confidence intervals (same as dakota)
+        [mu(i),sigma(i),muci(:,i),sigmaci(:,i)]=...
+            normfit(sampr(:,i),0.05);
+    end
+    display('Using calculated normal fits.')
+end
+
+for i=1:length(descr)
+    if isempty(descr{i})
+        descr(i)={['resp_' num2str(i)]};
+    end
+end
+
+%  parameters
+
+while (iarg <= nargin-1)
+    if ischar(varargin{iarg})
+        eval([varargin{iarg} '=varargin{iarg+1};']);
+        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
+    else
+        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
+    end
+    iarg=iarg+2;
+end
+
+%%  generate the intervals
+
+if ~exist('hmin','var')
+    hmin=min(min(sampr));
+end
+if ~exist('hmax','var')
+    hmax=max(max(sampr));
+end
+if ~exist('hnint','var')
+    hnint=50;
+end
+edges=hmin:(hmax-hmin)/hnint:hmax;
+
+%%  generate the histogram counts and make them relative
+
+%  note that for the histc function:
+%  n(k) counts the value x(i) if edges(k) <= x(i) < edges(k+1).
+%  The last bin counts any values of x that match edges(end).
+%  Values outside the values in edges are not counted.
+%  Use -inf and inf in edges to include all non-NaN values.
+
+dhistc=histc(sampr,edges);
+for i=1:size(sampr,2)
+    dbelow(i)  =length(find(sampr(:,i)<edges(  1)))/lsamp(i);
+    dhistc(:,i)=dhistc(:,i)                        /lsamp(i);
+    dabove(i)  =length(find(sampr(:,i)>edges(end)))/lsamp(i);
+end
+
+if exist('mu','var') && exist('sigma','var')
+    ncol=size(sampr,2);
+    for i=1:ncol
+        dbelow(end+1)=normcdf(edges(  1),mu(i),sigma(i));
+        dhistc(1:size(dhistc,1)-1,end+1)=...
+            normcdf(edges(2:end  ),mu(i),sigma(i))-...
+            normcdf(edges(1:end-1),mu(i),sigma(i));
+        dabove(end+1)=norminv(edges(end),mu(i),sigma(i));
+        if exist('descr','var')
+            descr(end+1)={[descr{i} ' norm']};
+        end
+    end
+end
+
+if exist('muci','var') && exist('sigmaci','var')
+    for i=1:ncol
+        dbelow(end+1)=normcdf(edges(  1),muci(1,i),sigmaci(2,i));
+        dhistc(1:size(dhistc,1)-1,end+1)=...
+            normcdf(edges(2:end  ),muci(1,i),sigmaci(2,i))-...
+            normcdf(edges(1:end-1),muci(1,i),sigmaci(2,i));
+        dabove(end+1)=norminv(edges(end),muci(1,i),sigmaci(2,i));
+        if exist('descr','var')
+            descr(end+1)={[descr{i} ' norm-+']};
+        end
+    end
+    for i=1:ncol
+        dbelow(end+1)=normcdf(edges(  1),muci(1,i),sigmaci(1,i));
+        dhistc(1:size(dhistc,1)-1,end+1)=...
+            normcdf(edges(2:end  ),muci(1,i),sigmaci(1,i))-...
+            normcdf(edges(1:end-1),muci(1,i),sigmaci(1,i));
+        dabove(end+1)=norminv(edges(end),muci(1,i),sigmaci(1,i));
+        if exist('descr','var')
+            descr(end+1)={[descr{i} ' norm--']};
+        end
+    end
+    for i=1:ncol
+        dbelow(end+1)=normcdf(edges(  1),muci(2,i),sigmaci(1,i));
+        dhistc(1:size(dhistc,1)-1,end+1)=...
+            normcdf(edges(2:end  ),muci(2,i),sigmaci(1,i))-...
+            normcdf(edges(1:end-1),muci(2,i),sigmaci(1,i));
+        dabove(end+1)=norminv(edges(end),muci(2,i),sigmaci(1,i));
+        if exist('descr','var')
+            descr(end+1)={[descr{i} ' norm+-']};
+        end
+    end
+    for i=1:ncol
+        dbelow(end+1)=normcdf(edges(  1),muci(2,i),sigmaci(2,i));
+        dhistc(1:size(dhistc,1)-1,end+1)=...
+            normcdf(edges(2:end  ),muci(2,i),sigmaci(2,i))-...
+            normcdf(edges(1:end-1),muci(2,i),sigmaci(2,i));
+        dabove(end+1)=norminv(edges(end),muci(2,i),sigmaci(2,i));
+        if exist('descr','var')
+            descr(end+1)={[descr{i} ' norm++']};
+        end
+    end
+end
+
+%  draw the bar plot
+
+figure
+if ~exist('nrmplt','var')
+    nrmplt='bar';
+end
+if ~exist('ciplt','var')
+    ciplt='bar';
+end
+
+hold all
+% hl1=bar(edges(1:end-1),dhistc(1:end-1,1:6*ncol));
+% hl1=line(edges(1:end-1),dhistc(1:end-1,1:6*ncol));
+if     strcmpi(nrmplt,'bar')
+    if     strcmpi(ciplt,'bar')
+        hl1=bar (edges(1:end-1),dhistc(1:end-1,1:6*ncol));
+    elseif strcmpi(ciplt,'line')
+        hl1=bar (edges(1:end-1),dhistc(1:end-1,1:2*ncol));
+        hl1(2*ncol+1:6*ncol)=...
+            line(edges(1:end-1),dhistc(1:end-1,2*ncol+1:6*ncol),...
+                 'LineWidth',2);
+    elseif strcmpi(ciplt,'off')
+        hl1=bar (edges(1:end-1),dhistc(1:end-1,1:2*ncol));
+    end
+elseif strcmpi(nrmplt,'line')
+    if     strcmpi(ciplt,'bar') || strcmpi(ciplt,'line')
+        hl1=bar (edges(1:end-1),dhistc(1:end-1,1:1*ncol));
+        hl1(1*ncol+1:2*ncol)=...
+            line(edges(1:end-1),dhistc(1:end-1,1*ncol+1:2*ncol),...
+                 'LineWidth',2);
+        hl1(2*ncol+1:6*ncol)=...
+            line(edges(1:end-1),dhistc(1:end-1,2*ncol+1:6*ncol),...
+                 'LineWidth',1);
+    elseif strcmpi(ciplt,'off')
+        hl1=bar (edges(1:end-1),dhistc(1:end-1,1:1*ncol));
+        hl1(1*ncol+1:2*ncol)=...
+            line(edges(1:end-1),dhistc(1:end-1,1*ncol+1:2*ncol),...
+                 'LineWidth',2);
+    end
+elseif strcmpi(nrmplt,'off')
+    hl1=bar (edges(1:end-1),dhistc(1:end-1,1:1*ncol));
+end
+ax1=gca;
+hold off
+
+%  set barseries properties for clarity
+
+if (length(hl1) > 1)
+    for i=1:length(hl1)
+        if strcmpi(get(hl1(i),'Type'),'hggroup')
+            set(hl1(i),'BarWidth',1,'EdgeColor','none');
+        end
+    end
+end
+
+%  set bars and lines to have a continuous colormap
+%  (if barseries is "flat", must interpolate and round to colormap)
+
+if exist('cmap','var')
+    colormap(cmap)
+end
+
+cmap=colormap;
+for i=1:length(hl1)
+    if (length(hl1) > 1)
+        imap=round((i-1)/(length(hl1)-1)*(size(cmap,1)-1))+1;
+    else
+        imap=1;
+    end
+    if     strcmpi(get(hl1(i),'Type'),'hggroup')
+        if ischar(get(hl1(i),'FaceColor')) && ...
+           strcmpi(get(hl1(i),'FaceColor'),'flat')
+            set(hl1(i),'FaceColor',cmap(imap,:))
+        else
+            set(hl1(i),'FaceColor',get(hl1(i),'FaceColor'))
+        end
+    elseif strcmpi(get(hl1(i),'Type'),'line')
+        set(hl1(i),'Color',cmap(imap,:))
+    end
+end
+    
+xlim('auto')
+[xlims]=xlim;
+if exist('hmin','var')
+    xlims(1)=edges(1);
+end
+if exist('hmax','var')
+    xlims(2)=edges(end-1);
+end
+xlim(xlims)
+
+ylim('auto')
+[ylims]=ylim;
+if exist('ymin1','var')
+    ylims(1)=ymin1;
+end
+if exist('ymax1','var')
+    ylims(2)=ymax1;
+end
+ylim(ylims)
+
+%  add the annotation
+
+if exist('cdfplt','var') && strcmpi(cdfplt,'off')
+    title('Relative Frequency Histogram')
+else
+    title('Relative Frequency Histogram with CDF')
+end
+xlabel('Interval Edge Value');
+ylabel('Relative Frequency');
+
+if exist('descr','var')
+    hleg1=legend(ax1,descr(1:length(hl1)),'Location','NorthWest',...
+                 'Color','none','Interpreter','none');
+else
+    hleg1=legend(ax1);
+end
+
+%%  generate the cumulative distribution functions
+
+if ~exist('cdfplt','var') || ~strcmpi(cdfplt,'off')
+%     cdf=zeros(size(dhistc));
+%     cdf(1,:)=dhistc(1,:);
+%     for i=2:size(dhistc,1)
+%         cdf(i,:)=cdf(i-1,:)+dhistc(i,:);
+%     end
+    cdf=cumsum(dhistc);
+    for i=1:size(dhistc,2)
+        cdf(:,i)=dbelow(i)+cdf(:,i);
+    end
+    if exist('descr','var')
+        ncol=length(descr);
+        for i=1:ncol
+            cdescr(i)={[descr{i} ' cdf']};
+        end
+    end
+
+%  draw the line plot
+
+%  (see "Using Multiple X- and Y-Axes" and "Overlaying Other
+%  Plots on Bar Graphs", or search on "YAxisLocation right")
+
+%     hold all
+%     hold on
+%     plot(edges,cdf)
+%     plotyy([],[],edges,cdf)
+
+%  ticks from the bar plot will show through on the right side,
+%  so make equal number of ticks for the line plot on right side
+
+    nytick=length(get(ax1,'YTick'));
+%     ylim('auto')
+%     [ylims]=ylim;
+    [ylims]=[0 ceil(max(max(cdf))/0.1-0.1)*0.1];
+    if exist('ymin2','var')
+        ylims(1)=ymin2;
+    end
+    if exist('ymax2','var')
+        ylims(2)=ymax2;
+    else
+        ylims(2)=ylims(1)+(nytick-1)/(nytick-1-1)*(ylims(2)-ylims(1));
+    end
+%     ylim(ylims)
+    ytinc =(ylims(2)-ylims(1))/(nytick-1);
+
+    ax2=axes('Position',get(ax1,'Position'),...
+             'XLim',get(ax1,'XLim'),...
+             'XTick',get(ax1,'XTick'),...
+             'YLim',ylims,...
+             'YTick',[ylims(1):ytinc:ylims(2)],...
+             'XAxisLocation','bottom','YAxisLocation','right',...
+             'Color','none','Layer','top');
+    hl2=line(edges(1:end-1),cdf(1:end-1,1:length(hl1)),'Parent',ax2);
+
+%  set line property colors to match barseries or line property
+%  (if barseries is "flat", must interpolate and round to colormap)
+
+    cmap=colormap;
+    for i=1:length(hl2)
+        if (length(hl2) > 1)
+            imap=round((i-1)/(length(hl2)-1)*(size(cmap,1)-1))+1;
+        else
+            imap=1;
+        end
+        if     strcmpi(get(hl1(i),'Type'),'hggroup')
+            if ischar(get(hl1(i),'FaceColor')) && ...
+               strcmpi(get(hl1(i),'FaceColor'),'flat')
+                set(hl2(i),'Color',cmap(imap,:))
+            else
+                set(hl2(i),'Color',get(hl1(i),'FaceColor'))
+            end
+        elseif strcmpi(get(hl1(i),'Type'),'line')
+            set(hl2(i),'Color',get(hl1(i),'Color'))
+        end
+    end
+
+%  add the annotation
+
+    ylabel('Cumulative Percent');
+
+    if ~exist('cdfleg','var') || ~strcmpi(cdfleg,'off')
+% legend doesn't combine with bar chart above
+        if exist('cdescr','var')
+            hleg2=legend(ax2,cdescr(1:length(hl2)),'Location','NorthEast',...
+                         'Color','none','Interpreter','none');
+%             set(hleg2,'Color','white')
+        else
+            hleg2=legend(ax2);
+%             set(hleg2,'Color','white')
+        end
+    end
+
+    set(gcf,'PaperPositionMode','auto')
+%     hold off
+end
+
+end
Index: /issm/trunk/src/m/qmu/plot/plot_if_bars.m
===================================================================
--- /issm/trunk/src/m/qmu/plot/plot_if_bars.m	(revision 4763)
+++ /issm/trunk/src/m/qmu/plot/plot_if_bars.m	(revision 4763)
@@ -0,0 +1,223 @@
+%
+%  plot a stacked bar chart of the importance factors.
+%
+%  []=plot_if_bars(dresp      ,params)
+%  []=plot_if_bars(dresp,descr,params)
+%
+%  where the required input is:
+%    dresp         (structure array, responses)
+%      or
+%    dresp         (structure array, responses)
+%    descr         (cell array, list of response descriptions desired)
+%
+%  the required fields of dresp are:
+%    descriptor    (char, description)
+%    var           (cell array, variables)
+%    impfac        (double array, importance factors)
+%
+%  the optional input is:
+%    params        (string/numeric, parameter names and values)
+%
+%  where the optional parameters are:
+%    ymin          (numeric, minimum of y-axis)
+%    ymax          (numeric, maximum of y-axis)
+%    ifmin         (double, minimum importance factor)
+%    isort         (numeric, sort flag:  0, no sorting;
+%                                        1, highest at bottom;
+%                                       -1, lowest at bottom)
+%    xtlrot        (numeric, rotation in degrees of x-tick labels)
+%
+%  for each response in the input array, this function plots
+%  a stacked bar plot of the responses, where the bars are
+%  stacked by the importance factors, and annotates it with the
+%  description.  the legend labels are constructed from the
+%  variable list.
+%
+%  this data would typically be contained in the dakota output
+%  file from a local reliability analysis and read by
+%  dakota_out_parse.
+%
+%  "Copyright 2009, by the California Institute of Technology.
+%  ALL RIGHTS RESERVED. United States Government Sponsorship
+%  acknowledged. Any commercial use must be negotiated with
+%  the Office of Technology Transfer at the California Institute
+%  of Technology.  (J. Schiermeier, NTR 47078)
+%
+%  This software may be subject to U.S. export control laws.
+%  By accepting this  software, the user agrees to comply with
+%  all applicable U.S. export laws and regulations. User has the
+%  responsibility to obtain export licenses, or other export
+%  authority as may be required before exporting such information
+%  to foreign countries or providing access to foreign persons."
+%
+function []=plot_if_bars(varargin)
+
+if ~nargin
+    help plot_if_bars
+    return
+end
+
+%%  process input data and assemble into matrices
+
+%  responses
+
+iarg=1;
+if isstruct(varargin{iarg})
+    dresp=varargin{iarg};
+    iarg=iarg+1;
+    
+%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
+    if iarg <= nargin && iscell(varargin{iarg})
+        dresp=struc_desc(dresp,varargin{iarg});
+        iarg=iarg+1;
+    end
+    
+    descr=cell (1,length(dresp));
+    lifr =zeros(1,length(dresp));
+    for i=1:length(dresp)
+        lifr(i)=length(dresp(i).impfac);
+    end
+    ifr =zeros(length(dresp),max(lifr));
+    dvar=dresp(find(lifr == max(lifr),1,'first')).var;
+
+    for i=1:length(dresp)
+        descr(i)=cellstr(dresp(i).descriptor);
+        ifr(i,1:lifr(i))=dresp(i).impfac;
+    end
+else
+    error(['''' inputname(iarg) ''' is not a structure.']);
+end
+
+%  parameters
+
+while (iarg <= nargin-1)
+    if ischar(varargin{iarg})
+        eval([varargin{iarg} '=varargin{iarg+1};']);
+        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
+    else
+        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
+    end
+    iarg=iarg+2;
+end
+
+if ~exist('ifmin','var') || isempty(ifmin)
+    ifmin=0;
+end
+
+if ~exist('isort','var') || isempty(isort)
+    isort=0;
+end
+
+%%  sort the data, if necessary
+
+if (isort)
+    ifmean=mean(ifr,1);
+    if (isort > 0)
+        [ifmean,index]=sort(ifmean,'descend');
+    else
+        [ifmean,index]=sort(ifmean,'ascend' );
+    end
+    clear ifmean
+    
+    dvar=dvar(index);
+    ifr =ifr (:,index);
+end
+
+%%  filter the data, if necessary
+
+if (ifmin > 0)
+    nif=length(dvar);
+    dvar(nif+1,1)=cellstr(sprintf('others < %f',ifmin));
+    ifr (:,nif+1)=0.;
+    
+    nif2=0;
+    dvar2=cell (size(dvar));
+    ifr2 =zeros(size(ifr ));
+    
+%  sum filtered rows and copy unfiltered rows
+
+    for i=1:nif
+        if (max(ifr(:,i)) < ifmin)
+            ifr(:,nif+1)=ifr(:,nif+1)+ifr(:,i);
+        else
+            nif2=nif2+1;
+            dvar2(nif2)  =dvar(i);
+            ifr2 (:,nif2)=ifr (:,i);
+        end
+    end
+    
+%  copy sums
+
+    dvar2(nif2+1)  =dvar(nif+1);
+    ifr2 (:,nif2+1)=ifr (:,nif+1);
+    
+%  copy back and truncate filtered rows
+
+    clear dvar ifr
+    if (isort >= 0)
+        dvar(1:nif2+1)  =dvar2(1:nif2+1);
+        ifr (:,1:nif2+1)=ifr2 (:,1:nif2+1);
+    else
+        dvar(1       )  =dvar2(  nif2+1);
+        dvar(2:nif2+1)  =dvar2(1:nif2  );
+        ifr (:,1       )=ifr2 (:,  nif2+1);
+        ifr (:,2:nif2+1)=ifr2 (:,1:nif2  );
+    end
+    clear nif nif2 dvar2 ifr2
+end
+
+%%  draw the stacked bar plot
+
+%  if there's only one row, Matlab 7.5 interprets it as a column,
+%  so add an extra row, then reduce xlim
+
+if length(dresp) == 1
+    ifr=[ifr; ifr];
+end
+
+figure
+hl1=bar(ifr,'stacked');
+
+ax1=gca;
+if length(dresp) == 1
+    set(ax1,'xlim',[0.5 1.5])
+end
+
+% set(ax1,'ylim',[0 1.2])
+% ylim('auto')
+% [ylims]=ylim;
+[ylims]=[0 1.2];
+if exist('ymin','var')
+    ylims(1)=ymin;
+end
+if exist('ymax','var')
+    ylims(2)=ymax;
+end
+ylim(ylims)
+
+set(ax1,'xtick',1:length(descr))
+set(ax1,'xticklabel',descr)
+if exist('xtlrot','var')
+    htl=rotateticklabel(ax1,xtlrot);
+    tlext=zeros(length(htl),4);
+    for i=1:length(htl)
+        tlext(i,:)=get(htl(i),'Extent');
+    end
+end
+
+%  add the annotation
+
+title('Importance Factors')
+xlabel('Response')
+if exist('xtlrot','var')
+    xlext=get(get(ax1,'xlabel'),'Extent');
+    nskip=ceil(max(tlext(:,4))/xlext(4));
+    xlabel(cellstr([repmat('        ',nskip,1);'Response']));
+    clear nskip xlext tlext
+end
+ylabel('Importance Factor Value')
+
+hleg1=legend(ax1,dvar,'Location','EastOutside',...
+             'Orientation','vertical','Interpreter','none');
+
+end
Index: /issm/trunk/src/m/qmu/plot/plot_normdist_bars.m
===================================================================
--- /issm/trunk/src/m/qmu/plot/plot_normdist_bars.m	(revision 4763)
+++ /issm/trunk/src/m/qmu/plot/plot_normdist_bars.m	(revision 4763)
@@ -0,0 +1,207 @@
+%
+%  plot a stacked bar chart of the sample distributions.
+%
+%  []=plot_normdist_bars(dresp      ,params)
+%  []=plot_normdist_bars(dresp,descr,params)
+%  []=plot_normdist_bars(sampr,descr,params)
+%
+%  where the required input is:
+%    dresp         (structure array, responses)
+%      or
+%    dresp         (structure array, responses)
+%    descr         (cell array, list of response descriptions desired)
+%      or
+%    sampr         (double array, lists of response samples)
+%    descr         (cell array, list of response descriptions)
+%
+%  the required fields of dresp are:
+%    descriptor    (char, description)
+%    sample        (double vector, list of samples)
+%
+%  and the optional fields of dresp are:
+%    mean          (double, mean of sample)
+%    stddev        (double, standard deviation of sample)
+%
+%  the optional input is:
+%    params        (string/numeric, parameter names and values)
+%
+%  where the optional parameters are:
+%    prob          (double vector, probability levels)
+%    ymin          (numeric, minimum of y-axis)
+%    ymax          (numeric, maximum of y-axis)
+%    xtlrot        (numeric, rotation in degrees of x-tick labels)
+%    lstr          (cell array, legend labels)
+%
+%  for each response in the input array, this function plots
+%  a stacked bar plot of the list of samples, where the bars
+%  are stacked by the given or default probability levels
+%  calculated from a normal distribution, and annotates it with
+%  the description.  the mean and standard deviation will be
+%  calculated from the samples if they do not already exist.
+%  the legend labels can be given or constructed from the
+%  probability levels.
+%
+%  this data would typically be contained in the dakota tabular
+%  output file and read by dakota_out_parse.
+%
+%  "Copyright 2009, by the California Institute of Technology.
+%  ALL RIGHTS RESERVED. United States Government Sponsorship
+%  acknowledged. Any commercial use must be negotiated with
+%  the Office of Technology Transfer at the California Institute
+%  of Technology.  (J. Schiermeier, NTR 47078)
+%
+%  This software may be subject to U.S. export control laws.
+%  By accepting this  software, the user agrees to comply with
+%  all applicable U.S. export laws and regulations. User has the
+%  responsibility to obtain export licenses, or other export
+%  authority as may be required before exporting such information
+%  to foreign countries or providing access to foreign persons."
+%
+function []=plot_normdist_bars(varargin)
+
+if ~nargin
+    help plot_normdist_bars
+    return
+end
+
+%%  process input data and assemble into dresp as needed
+
+%  responses
+
+iarg=1;
+if isstruct(varargin{iarg})
+    dresp=varargin{iarg};
+    iarg=iarg+1;
+    
+%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
+    if iarg <= nargin && iscell(varargin{iarg})
+        dresp=struc_desc(dresp,varargin{iarg});
+        iarg=iarg+1;
+    end
+else
+    sampr=varargin{iarg};
+    iarg=iarg+1;
+    
+    if     iarg <= nargin && iscell(varargin{iarg})
+        descr=varargin{iarg};
+        iarg=iarg+1;
+%     elseif iarg <= nargin && ischar(varargin{iarg})
+%         descr=cellstr(varargin{iarg});
+%         iarg=iarg+1;
+    else
+        descr=cell(1:size(sampr,2));
+    end
+    
+    dresp=struct([]);
+    for i=1:size(sampr,2)
+        dresp(end+1).sample=samp(:,i);
+        if ~isempty(descr)
+            dresp(i).descriptor=descr{i};
+        else
+            dresp(i).descriptor=['dresp_' num2str(i)];
+        end
+    end
+end
+
+%  parameters
+
+while (iarg <= nargin-1)
+    if ischar(varargin{iarg})
+        eval([varargin{iarg} '=varargin{iarg+1};']);
+        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
+    else
+        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
+    end
+    iarg=iarg+2;
+end
+
+%%  calculate any missing information (noting that dresp is local)
+
+if ~isfield(dresp,'mean') || ~isfield(dresp,'stddev')
+    for i=1:length(dresp)
+        [dresp(i).mean,dresp(i).stddev]=normfit(dresp(i).sample);
+    end
+end
+
+%%  assemble the data into a matrix and calculate the increments
+
+if ~exist('prob','var') || isempty(prob)
+    prob=[0.01 0.25 0.50 0.75 0.99];
+end
+
+descr=cell (1,length(dresp));
+data =zeros(length(dresp),length(prob));
+
+for i=1:length(dresp)
+    descr(i)=cellstr(dresp(i).descriptor);
+    data(i,:)=norminv(prob,dresp(i).mean,dresp(i).stddev);
+end
+
+for j=length(prob):-1:2
+    data(:,j)=data(:,j)-data(:,j-1);
+end
+
+%%  draw the stacked bar plot
+
+%  if there's only one row, Matlab 7.5 interprets it as a column,
+%  so add an extra row, then reduce xlim
+
+if length(dresp) == 1
+    data=[data; data];
+end
+
+figure
+hl1=bar(data,'stacked');
+%  set barseries properties for lowest value
+whitebg('white')
+set(hl1(1),'FaceColor','white')
+set(hl1(1),'Visible','off')
+
+ax1=gca;
+if length(dresp) == 1
+    set(ax1,'xlim',[0.5 1.5])
+end
+
+ylim('auto')
+[ylims]=ylim;
+if exist('ymin','var')
+    ylims(1)=ymin;
+end
+if exist('ymax','var')
+    ylims(2)=ymax;
+end
+ylim(ylims)
+
+set(ax1,'xtick',1:length(descr))
+set(ax1,'xticklabel',descr)
+if exist('xtlrot','var')
+    htl=rotateticklabel(ax1,xtlrot);
+    tlext=zeros(length(htl),4);
+    for i=1:length(htl)
+        tlext(i,:)=get(htl(i),'Extent');
+    end
+end
+
+%  add the annotation
+
+title('Normal Distributions of Responses')
+xlabel('Response')
+if exist('xtlrot','var')
+    xlext=get(get(ax1,'xlabel'),'Extent');
+    nskip=ceil(max(tlext(:,4))/xlext(4));
+    xlabel(cellstr([repmat('        ',nskip,1);'Response']));
+    clear nskip xlext tlext
+end
+ylabel('Value')
+
+if ~exist('lstr','var') || isempty(lstr)
+    lstr=cell(1,length(prob));
+    for i=1:length(prob)
+        lstr(i)=cellstr(sprintf('%g%%',100*prob(i)));
+    end
+end
+
+hleg1=legend(ax1,lstr,'Location','EastOutside',...
+             'Orientation','vertical','Interpreter','none');
+
+end
Index: /issm/trunk/src/m/qmu/plot/plot_normplot.m
===================================================================
--- /issm/trunk/src/m/qmu/plot/plot_normplot.m	(revision 4763)
+++ /issm/trunk/src/m/qmu/plot/plot_normplot.m	(revision 4763)
@@ -0,0 +1,148 @@
+%
+%  plot a normal probability plot of the responses.
+%
+%  []=plot_normplot(dresp      ,params)
+%  []=plot_normplot(dresp,descr,params)
+%  []=plot_normplot(sampr,descr,params)
+%
+%  where the required input is:
+%    dresp         (structure array, responses)
+%      or
+%    dresp         (structure array, responses)
+%    descr         (cell array, list of response descriptions desired)
+%      or
+%    sampr         (double array, lists of response samples)
+%    descr         (cell array, list of response descriptions)
+%
+%  the required fields of dresp are:
+%    descriptor    (char, description)
+%    sample        (double vector, list of samples)
+%
+%  the optional input is:
+%    params        (string/numeric, parameter names and values)
+%
+%  where the optional parameters are:
+%    xmin          (numeric, minimum of x-axis)
+%    xmax          (numeric, maximum of x-axis)
+%
+%  for each response in the input array, this function plots
+%  a matlab normal probability plot of the list of samples
+%  and annotates it with the description.  the lists of samples
+%  need not all be the same length.
+%
+%  this data would typically be contained in the dakota tabular
+%  output file and read by dakota_out_parse.
+%
+%  "Copyright 2009, by the California Institute of Technology.
+%  ALL RIGHTS RESERVED. United States Government Sponsorship
+%  acknowledged. Any commercial use must be negotiated with
+%  the Office of Technology Transfer at the California Institute
+%  of Technology.  (J. Schiermeier, NTR 47078)
+%
+%  This software may be subject to U.S. export control laws.
+%  By accepting this  software, the user agrees to comply with
+%  all applicable U.S. export laws and regulations. User has the
+%  responsibility to obtain export licenses, or other export
+%  authority as may be required before exporting such information
+%  to foreign countries or providing access to foreign persons."
+%
+function []=plot_normplot(varargin)
+
+if ~nargin
+    help plot_normplot
+    return
+end
+
+%%  process input data and assemble into matrices as needed
+
+%  responses
+
+iarg=1;
+if isstruct(varargin{iarg})
+    dresp=varargin{iarg};
+    iarg=iarg+1;
+    
+%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
+    if iarg <= nargin && iscell(varargin{iarg})
+        dresp=struc_desc(dresp,varargin{iarg});
+        iarg=iarg+1;
+    end
+    
+    descr=cell (1,length(dresp));
+    lsamp=zeros(1,length(dresp));
+    for i=1:length(dresp)
+        lsamp(i)=length(dresp(i).sample);
+    end
+    sampr=zeros(max(lsamp),length(dresp));
+    sampr(:,:)=NaN;
+
+    for i=1:length(dresp)
+        descr(i)=cellstr(dresp(i).descriptor);
+        sampr(1:lsamp(i),i)=dresp(i).sample;
+    end
+else
+    sampr=varargin{iarg};
+    iarg=iarg+1;
+    
+    if     iarg <= nargin && iscell(varargin{iarg})
+        descr=varargin{iarg};
+        iarg=iarg+1;
+%     elseif iarg <= nargin && ischar(varargin{iarg})
+%         descr=cellstr(varargin{iarg});
+%         iarg=iarg+1;
+    else
+        descr=cell(1,size(sampr,2));
+    end
+end
+
+for i=1:length(descr)
+    if isempty(descr{i})
+        descr(i)={['resp_' num2str(i)]};
+    end
+end
+
+%  parameters
+
+while (iarg <= nargin-1)
+    if ischar(varargin{iarg})
+        eval([varargin{iarg} '=varargin{iarg+1};']);
+        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
+    else
+        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
+    end
+    iarg=iarg+2;
+end
+    
+%%  draw the plot
+
+%  draw normal probability plot
+
+figure
+normplot(sampr)
+ax1=gca;
+
+%  add the annotation
+
+xlim('auto')
+[xlims]=xlim;
+if exist('xmin','var')
+    xlims(1)=xmin;
+end
+if exist('xmax','var')
+    xlims(2)=xmax;
+end
+xlim(xlims)
+
+if (size(sampr,2) == 1)
+    tlabc=descr{1};
+else
+    tlabc='Responses';
+end
+title(['Normal Probability Plot of ' tlabc],'Interpreter','none');
+xlabel('Value'      ,'Interpreter','none');
+ylabel('Probability','Interpreter','none');
+
+hleg1=legend(ax1,descr,'Location','EastOutside',...
+             'Orientation','vertical','Interpreter','none');
+
+end
Index: /issm/trunk/src/m/qmu/plot/plot_prob_bars.m
===================================================================
--- /issm/trunk/src/m/qmu/plot/plot_prob_bars.m	(revision 4763)
+++ /issm/trunk/src/m/qmu/plot/plot_prob_bars.m	(revision 4763)
@@ -0,0 +1,191 @@
+%
+%  plot a stacked bar chart of the probabilities in the CDF.
+%
+%  []=plot_prob_bars(dresp      ,params)
+%  []=plot_prob_bars(dresp,descr,params)
+%
+%  where the required input is:
+%    dresp         (structure array, responses)
+%      or
+%    dresp         (structure array, responses)
+%    descr         (cell array, list of response descriptions desired)
+%
+%  the required fields of dresp are:
+%    descriptor    (char, description)
+%    cdf(:,4)      (double matrix, CDF table)
+%
+%  the optional input is:
+%    params        (string/numeric, parameter names and values)
+%
+%  where the optional parameters are:
+%    ymin          (numeric, minimum of y-axis)
+%    ymax          (numeric, maximum of y-axis)
+%    xtlrot        (numeric, rotation in degrees of x-tick labels)
+%    cmap          (char, 'stoplight' for 6-color stoplight colormap)
+%    lstr          (cell array, legend labels)
+%
+%  for each response in the input array, this function plots
+%  a stacked bar plot of the responses, where the bars are
+%  stacked by the probabilities corresponding to the given
+%  response levels in the CDF, and annotates it with the
+%  description.  the legend labels can be given or constructed
+%  from the response levels.
+%
+%  this data would typically be contained in the dakota output
+%  file and read by dakota_out_parse.
+%
+%  "Copyright 2009, by the California Institute of Technology.
+%  ALL RIGHTS RESERVED. United States Government Sponsorship
+%  acknowledged. Any commercial use must be negotiated with
+%  the Office of Technology Transfer at the California Institute
+%  of Technology.  (J. Schiermeier, NTR 47078)
+%
+%  This software may be subject to U.S. export control laws.
+%  By accepting this  software, the user agrees to comply with
+%  all applicable U.S. export laws and regulations. User has the
+%  responsibility to obtain export licenses, or other export
+%  authority as may be required before exporting such information
+%  to foreign countries or providing access to foreign persons."
+%
+function []=plot_prob_bars(varargin)
+
+if ~nargin
+    help plot_prob_bars
+    return
+end
+
+%%  assemble the data into a matrix and calculate the increments
+
+
+%%  process input data and assemble into matrices and increments
+
+%  responses
+
+iarg=1;
+if isstruct(varargin{iarg})
+    dresp=varargin{iarg};
+    iarg=iarg+1;
+    
+%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
+    if iarg <= nargin && iscell(varargin{iarg})
+        dresp=struc_desc(dresp,varargin{iarg});
+        iarg=iarg+1;
+    end
+    
+    descr=cell (1,length(dresp));
+    lcdfr=zeros(1,length(dresp));
+    for i=1:length(dresp)
+        lcdfr(i)=size(dresp(i).cdf,1);
+    end
+    cdfr=zeros(length(dresp),max(lcdfr));
+
+    for i=1:length(dresp)
+        descr(i)=cellstr(dresp(i).descriptor);
+        if ~isempty(dresp(i).cdf)
+            cdfr(i,1)=dresp(i).cdf(1,2);
+            for j=2:size(dresp(i).cdf,1)
+                if (dresp(i).cdf(j,2) > dresp(i).cdf(j-1,2))
+                    cdfr(i,j)=dresp(i).cdf(j,2)-dresp(i).cdf(j-1,2);
+                end
+            end
+        end
+    end
+else
+    error(['''' inputname(iarg) ''' is not a structure.']);
+end
+
+%  convert to percentage
+
+cdfr=cdfr*100.;
+
+%  parameters
+
+while (iarg <= nargin-1)
+    if ischar(varargin{iarg})
+        eval([varargin{iarg} '=varargin{iarg+1};']);
+        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
+    else
+        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
+    end
+    iarg=iarg+2;
+end
+
+%%  draw the stacked bar plot
+
+%  if there's only one row, Matlab 7.5 interprets it as a column,
+%  so add an extra row, then reduce xlim
+
+if length(dresp) == 1
+    cdfr=[cdfr; cdfr];
+end
+
+figure
+hl1=bar(cdfr,'stacked');
+if exist('cmap','var')
+    if strncmpi(cmap,'stop',4)
+%         set(hl1(1),'FaceColor','green')
+%         set(hl1(2),'FaceColor',[.7 1 0])
+%         set(hl1(3),'FaceColor','yellow')
+%         set(hl1(4),'FaceColor',[1 .7 0])
+%         set(hl1(5),'FaceColor',[1 .5 0])
+%         set(hl1(6),'FaceColor','red')
+        colormap([0 1 0;.7 1 0;1 1 0;1 .7 0;1 .5 0;1 0 0]);
+    else
+        colormap(cmap);
+    end
+end
+
+ax1=gca;
+if length(dresp) == 1
+    set(ax1,'xlim',[0.5 1.5])
+end
+
+% set(ax1,'ylim',[0 120])
+% ylim('auto')
+% [ylims]=ylim;
+[ylims]=[0 120];
+if exist('ymin','var')
+    ylims(1)=ymin;
+end
+if exist('ymax','var')
+    ylims(2)=ymax;
+end
+ylim(ylims)
+
+set(ax1,'xtick',1:length(descr))
+set(ax1,'xticklabel',descr)
+if exist('xtlrot','var')
+    htl=rotateticklabel(ax1,xtlrot);
+    tlext=zeros(length(htl),4);
+    for i=1:length(htl)
+        tlext(i,:)=get(htl(i),'Extent');
+    end
+end
+
+%  add the annotation
+
+title('Probabilities for Specified Response Levels (RIA)')
+xlabel('Response')
+if exist('xtlrot','var')
+    xlext=get(get(ax1,'xlabel'),'Extent');
+    nskip=ceil(max(tlext(:,4))/xlext(4));
+    xlabel(cellstr([repmat('        ',nskip,1);'Response']));
+    clear nskip xlext tlext
+end
+ylabel('Percent Below Level')
+
+if ~exist('lstr','var') || isempty(lstr)
+    lstr=cell(1,max(lcdfr));
+    for i=1:max(lcdfr)
+        lstr(i)=cellstr(sprintf('%g',...
+            dresp(find(lcdfr == max(lcdfr),1,'first')).cdf(i,1)));
+    end
+    if ~isempty(find(lcdfr < max(lcdfr)))
+        warning('Variable number of levels for responses.');
+    end
+end
+
+hleg1=legend(ax1,lstr,'Location','EastOutside',...
+             'Orientation','vertical','Interpreter','none');
+
+end
Index: /issm/trunk/src/m/qmu/plot/plot_rlev_bars.m
===================================================================
--- /issm/trunk/src/m/qmu/plot/plot_rlev_bars.m	(revision 4763)
+++ /issm/trunk/src/m/qmu/plot/plot_rlev_bars.m	(revision 4763)
@@ -0,0 +1,172 @@
+%
+%  plot a stacked bar chart of the response levels in the cdf.
+%
+%  []=plot_rlev_bars(dresp      ,params)
+%  []=plot_rlev_bars(dresp,descr,params)
+%
+%  where the required input is:
+%    dresp         (structure array, responses)
+%      or
+%    dresp         (structure array, responses)
+%    descr         (cell array, list of response descriptions desired)
+%
+%  the required fields of dresp are:
+%    descriptor    (char, description)
+%    cdf(:,4)      (double matrix, CDF table)
+%
+%  the optional input is:
+%    params        (string/numeric, parameter names and values)
+%
+%  where the optional parameters are:
+%    ymin          (numeric, minimum of y-axis)
+%    ymax          (numeric, maximum of y-axis)
+%    xtlrot        (numeric, rotation in degrees of x-tick labels)
+%    lstr          (cell array, legend labels)
+%
+%  for each response in the input array, this function plots
+%  a stacked bar plot of the responses, where the bars are
+%  stacked by the response levels corresponding to the given
+%  probabilities in the CDF, and annotates it with the
+%  description.  the legend labels can be given or constructed
+%  from the probabilities.
+%
+%  this data would typically be contained in the dakota output
+%  file and read by dakota_out_parse.
+%
+%  "Copyright 2009, by the California Institute of Technology.
+%  ALL RIGHTS RESERVED. United States Government Sponsorship
+%  acknowledged. Any commercial use must be negotiated with
+%  the Office of Technology Transfer at the California Institute
+%  of Technology.  (J. Schiermeier, NTR 47078)
+%
+%  This software may be subject to U.S. export control laws.
+%  By accepting this  software, the user agrees to comply with
+%  all applicable U.S. export laws and regulations. User has the
+%  responsibility to obtain export licenses, or other export
+%  authority as may be required before exporting such information
+%  to foreign countries or providing access to foreign persons."
+%
+function []=plot_rlev_bars(varargin)
+
+if ~nargin
+    help plot_rlev_bars
+    return
+end
+
+%%  process input data and assemble into matrices and increments
+
+%  responses
+
+iarg=1;
+if isstruct(varargin{iarg})
+    dresp=varargin{iarg};
+    iarg=iarg+1;
+    
+%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
+    if iarg <= nargin && iscell(varargin{iarg})
+        dresp=struc_desc(dresp,varargin{iarg});
+        iarg=iarg+1;
+    end
+    
+    descr=cell (1,length(dresp));
+    lcdfr=zeros(1,length(dresp));
+    for i=1:length(dresp)
+        lcdfr(i)=size(dresp(i).cdf,1);
+    end
+    cdfr=zeros(length(dresp),max(lcdfr));
+
+    for i=1:length(dresp)
+        descr(i)=cellstr(dresp(i).descriptor);
+        if ~isempty(dresp(i).cdf)
+            cdfr(i,1)=dresp(i).cdf(1,1);
+            for j=2:size(dresp(i).cdf,1)
+                if (dresp(i).cdf(j,1) > dresp(i).cdf(j-1,1))
+                    cdfr(i,j)=dresp(i).cdf(j,1)-dresp(i).cdf(j-1,1);
+                end
+            end
+        end
+    end
+else
+    error(['''' inputname(iarg) ''' is not a structure.']);
+end
+
+%  parameters
+
+while (iarg <= nargin-1)
+    if ischar(varargin{iarg})
+        eval([varargin{iarg} '=varargin{iarg+1};']);
+        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
+    else
+        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
+    end
+    iarg=iarg+2;
+end
+
+%%  draw the stacked bar plot
+
+%  if there's only one row, Matlab 7.5 interprets it as a column,
+%  so add an extra row, then reduce xlim
+
+if length(dresp) == 1
+    cdfr=[cdfr; cdfr];
+end
+
+figure
+hl1=bar(cdfr,'stacked');
+%  set barseries properties for lowest value
+whitebg('white')
+set(hl1(1),'FaceColor','white')
+set(hl1(1),'Visible','off')
+
+ax1=gca;
+if length(dresp) == 1
+    set(ax1,'xlim',[0.5 1.5])
+end
+
+ylim('auto')
+[ylims]=ylim;
+if exist('ymin','var')
+    ylims(1)=ymin;
+end
+if exist('ymax','var')
+    ylims(2)=ymax;
+end
+ylim(ylims)
+
+set(ax1,'xtick',1:length(descr))
+set(ax1,'xticklabel',descr)
+if exist('xtlrot','var')
+    htl=rotateticklabel(ax1,xtlrot);
+    tlext=zeros(length(htl),4);
+    for i=1:length(htl)
+        tlext(i,:)=get(htl(i),'Extent');
+    end
+end
+
+%  add the annotation
+
+title('Response Levels for Specified Probabilities (PMA)')
+xlabel('Response');
+if exist('xtlrot','var')
+    xlext=get(get(ax1,'xlabel'),'Extent');
+    nskip=ceil(max(tlext(:,4))/xlext(4));
+    xlabel(cellstr([repmat('        ',nskip,1);'Response']));
+    clear nskip xlext tlext
+end
+ylabel('Response Level')
+
+if ~exist('lstr','var') || isempty(lstr)
+    lstr=cell(1,max(lcdfr));
+    for i=1:max(lcdfr)
+        lstr(i)=cellstr(sprintf('%g%%',...
+            100*dresp(find(lcdfr == max(lcdfr),1,'first')).cdf(i,2)));
+    end
+    if ~isempty(find(lcdfr < max(lcdfr),1))
+        warning('Variable number of probabilities for responses.');
+    end
+end
+
+hleg1=legend(ax1,lstr,'Location','EastOutside',...
+             'Orientation','vertical','Interpreter','none');
+
+end
Index: /issm/trunk/src/m/qmu/plot/plot_rlev_bars_ci.m
===================================================================
--- /issm/trunk/src/m/qmu/plot/plot_rlev_bars_ci.m	(revision 4763)
+++ /issm/trunk/src/m/qmu/plot/plot_rlev_bars_ci.m	(revision 4763)
@@ -0,0 +1,263 @@
+%
+%  plot a stacked bar chart of the response levels in the cdf
+%  for the sample and confidence intervals.
+%
+%  []=plot_rlev_bars_ci(dresp      ,params)
+%  []=plot_rlev_bars_ci(dresp,descr,params)
+%  []=plot_rlev_bars_ci(sampr,descr,params)
+%
+%  where the required input is:
+%    dresp         (structure array, responses)
+%      or
+%    dresp         (structure array, responses)
+%    descr         (cell array, list of response descriptions desired)
+%      or
+%    sampr         (double array, lists of response samples)
+%    descr         (cell array, list of response descriptions)
+%
+%  the required fields of dresp are:
+%    descriptor    (char, description)
+%    cdf(:,4)      (double matrix, CDF table)
+%
+%  and the optional fields of dresp are:
+%    mean          (double, mean of sample)
+%    stddev        (double, standard deviation of sample)
+%    meanci(2)     (double, confidence interval of mean)
+%    stddevci(2)   (double, confidence interval of standard deviation)
+%
+%  the optional input is:
+%    params        (string/numeric, parameter names and values)
+%
+%  where the optional parameters are:
+%    ymin          (numeric, minimum of y-axis)
+%    ymax          (numeric, maximum of y-axis)
+%    xtlrot        (numeric, rotation in degrees of x-tick labels)
+%    lstr          (cell array, legend labels)
+%
+%  for each response in the input array, this function plots
+%  a stacked bar plot of the responses, where the bars are
+%  stacked by the response levels corresponding to the given
+%  probabilities in the CDF, and annotates it with the
+%  description.  the response levels for the normal distribution
+%  and the confidence intervals are also plotted.  the legend
+%  labels can be given or constructed from the probabilities.
+%
+%  dresp data would typically be contained in the dakota tabular
+%  output file from a sampling analysis, read by dakota_out_parse.
+%
+%  "Copyright 2009, by the California Institute of Technology.
+%  ALL RIGHTS RESERVED. United States Government Sponsorship
+%  acknowledged. Any commercial use must be negotiated with
+%  the Office of Technology Transfer at the California Institute
+%  of Technology.  (J. Schiermeier, NTR 47078)
+%
+%  This software may be subject to U.S. export control laws.
+%  By accepting this  software, the user agrees to comply with
+%  all applicable U.S. export laws and regulations. User has the
+%  responsibility to obtain export licenses, or other export
+%  authority as may be required before exporting such information
+%  to foreign countries or providing access to foreign persons."
+%
+function []=plot_rlev_bars_ci(varargin)
+
+if ~nargin
+    help plot_rlev_bars_ci
+    return
+end
+
+%%  process input data and assemble into dresp as needed
+
+%  responses
+
+iarg=1;
+if isstruct(varargin{iarg})
+    dresp=varargin{iarg};
+    iarg=iarg+1;
+    
+%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
+    if iarg <= nargin && iscell(varargin{iarg})
+        dresp=struc_desc(dresp,varargin{iarg});
+        iarg=iarg+1;
+    end
+else
+    sampr=varargin{iarg};
+    iarg=iarg+1;
+    
+    if     iarg <= nargin && iscell(varargin{iarg})
+        descr=varargin{iarg};
+        iarg=iarg+1;
+%     elseif iarg <= nargin && ischar(varargin{iarg})
+%         descr=cellstr(varargin{iarg});
+%         iarg=iarg+1;
+    else
+        descr=cell(1:size(sampr,2));
+    end
+    
+    dresp=struct([]);
+    for i=1:size(sampr,2)
+        dresp(end+1).sample=sampr(:,i);
+        if ~isempty(descr)
+            dresp(i).descriptor=descr{i};
+        else
+            dresp(i).descriptor=['dresp_' num2str(i)];
+        end
+    end
+end
+
+%  parameters
+
+while (iarg <= nargin-1)
+    if ischar(varargin{iarg})
+        eval([varargin{iarg} '=varargin{iarg+1};']);
+        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
+    else
+        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
+    end
+    iarg=iarg+2;
+end
+
+%%  calculate any missing information (noting that dresp is local)
+
+for i=1:length(dresp)
+    if ~isfield(dresp(i),'mean') || isempty(dresp(i).mean) || ...
+       ~isfield(dresp(i),'stddev') || isempty(dresp(i).stddev) || ...
+       ~isfield(dresp(i),'meanci') || isempty(dresp(i).meanci) || ...
+       ~isfield(dresp(i),'stddevci') || isempty(dresp(i).stddevci)
+%  calculate 95% confidence intervals (same as dakota)
+        [dresp(i).mean,dresp(i).stddev,...
+         dresp(i).meanci,dresp(i).stddevci]=...
+            normfit(sampr(:,i),0.05);
+        display('Using calculated normal fits from sample data.')
+    end
+    
+    if ~isfield(dresp(i),'cdf') || isempty(dresp(i).cdf)
+%  use minus/plus integer standard deviations
+        sdvect=[-4 -3 -2 -1 0 1 2 3 4];
+        dresp(i).cdf(:,2)=normcdf(sdvect,0,1);
+        dresp(i).cdf(:,1)=norminv(dresp(i).cdf(:,2),...
+                                  dresp(i).mean,dresp(i).stddev);
+        display('Using integer standard deviations for percentages.')
+
+        if ~exist('lstr','var') || isempty(lstr)
+            lstr=cell(1,size(dresp(i).cdf,1));
+            for j=1:size(dresp(i).cdf,1)
+                if sdvect(j)
+                    lstr{j}=sprintf('mu %+d sigma',sdvect(j));
+                else
+                    lstr{j}='mu';
+                end
+            end
+        end
+    end
+end
+
+%%  assemble the data into a matrix and calculate the increments
+
+descr=cell (1,0);
+lcdfr=zeros(1,length(dresp));
+for i=1:length(dresp)
+    lcdfr(i)=size(dresp(i).cdf,1);
+end
+cdfr=zeros(0,max(lcdfr));
+
+%  fill in the cdf data
+
+for i=1:length(dresp)
+    if ~isempty(dresp(i).cdf)
+        descr(end+1)=cellstr([dresp(i).descriptor]);
+        cdfr(end+1,:)=dresp(i).cdf(:,1);
+        if isfield(dresp(i),'mean'  ) && ~isempty(dresp(i).mean  ) && ...
+           isfield(dresp(i),'stddev') && ~isempty(dresp(i).stddev)
+            descr(end+1)=cellstr([dresp(i).descriptor ' norm']);
+            cdfr(end+1,:)=norminv(dresp(i).cdf(:,2),dresp(i).mean,dresp(i).stddev);
+        end
+        if isfield(dresp(i),'meanci'  ) && ~isempty(dresp(i).meanci  ) && ...
+           isfield(dresp(i),'stddevci') && ~isempty(dresp(i).stddevci)
+            descr(end+1)=cellstr([dresp(i).descriptor ' norm-+']);
+            descr(end+1)=cellstr([dresp(i).descriptor ' norm--']);
+            descr(end+1)=cellstr([dresp(i).descriptor ' norm+-']);
+            descr(end+1)=cellstr([dresp(i).descriptor ' norm++']);
+            cdfr(end+1,:)=norminv(dresp(i).cdf(:,2),dresp(i).meanci(1),dresp(i).stddevci(2));
+            cdfr(end+1,:)=norminv(dresp(i).cdf(:,2),dresp(i).meanci(1),dresp(i).stddevci(1));
+            cdfr(end+1,:)=norminv(dresp(i).cdf(:,2),dresp(i).meanci(2),dresp(i).stddevci(1));
+            cdfr(end+1,:)=norminv(dresp(i).cdf(:,2),dresp(i).meanci(2),dresp(i).stddevci(2));
+        end
+    end
+end
+
+%  calculate the increments
+
+for i=1:size(cdfr,1)
+    for j=find(cdfr(i,:),1,'last'):-1:2
+        cdfr(i,j)=cdfr(i,j)-cdfr(i,j-1);
+    end
+end
+
+%%  draw the stacked bar plot
+
+%  if there's only one row, Matlab 7.5 interprets it as a column,
+%  so add an extra row, then reduce xlim
+
+if length(descr) == 1
+    cdfr=[cdfr; cdfr];
+end
+
+figure
+hl1=bar(cdfr,'stacked');
+%  set barseries properties for lowest value
+whitebg('white')
+set(hl1(1),'FaceColor','white')
+set(hl1(1),'Visible','off')
+
+ax1=gca;
+if length(descr) == 1
+    set(ax1,'xlim',[0.5 1.5])
+end
+
+ylim('auto')
+[ylims]=ylim;
+if exist('ymin','var')
+    ylims(1)=ymin;
+end
+if exist('ymax','var')
+    ylims(2)=ymax;
+end
+ylim(ylims)
+
+set(ax1,'xtick',1:length(descr))
+set(ax1,'xticklabel',descr)
+if exist('xtlrot','var')
+    htl=rotateticklabel(ax1,xtlrot);
+    tlext=zeros(length(htl),4);
+    for i=1:length(htl)
+        tlext(i,:)=get(htl(i),'Extent');
+    end
+end
+
+%  add the annotation
+
+title('Response Levels for Specified Probabilities (PMA)');
+xlabel('Response');
+if exist('xtlrot','var')
+    xlext=get(get(ax1,'xlabel'),'Extent');
+    nskip=ceil(max(tlext(:,4))/xlext(4));
+    xlabel(cellstr([repmat('        ',nskip,1);'Response']));
+    clear nskip xlext tlext
+end
+ylabel('Response Level');
+
+if ~exist('lstr','var') || isempty(lstr)
+    lstr=cell(1,max(lcdfr));
+    for i=1:max(lcdfr)
+        lstr(i)=cellstr(sprintf('%g%%',...
+            100*dresp(find(lcdfr == max(lcdfr),1,'first')).cdf(i,2)));
+    end
+    if ~isempty(find(lcdfr < max(lcdfr),1,'first'))
+        warning('Variable number of probabilities for responses.');
+    end
+end
+
+hleg1=legend(ax1,lstr,'Location','EastOutside',...
+             'Orientation','vertical','Interpreter','none');
+
+end
Index: /issm/trunk/src/m/qmu/plot/plot_rvsv_line.m
===================================================================
--- /issm/trunk/src/m/qmu/plot/plot_rvsv_line.m	(revision 4763)
+++ /issm/trunk/src/m/qmu/plot/plot_rvsv_line.m	(revision 4763)
@@ -0,0 +1,257 @@
+%
+%  plot line plots of responses vs. variables.
+%
+%  []=plot_rvsv_line(dvar       ,dresp      ,params)
+%  []=plot_rvsv_line(dvar ,descv,dresp,descr,params)
+%  []=plot_rvsv_line(sampv,descv,sampr,descr,params)
+%
+%  where the required input is:
+%    dvar          (structure array, variables)
+%      or
+%    dvar          (structure array, variables)
+%    descv         (cell array, list of variable descriptions desired)
+%      or
+%    sampv         (double array, lists of variable samples)
+%    descv         (cell array, list of variable descriptions)
+%
+%    dresp         (structure array, responses)
+%      or
+%    dresp         (structure array, responses)
+%    descr         (cell array, list of response descriptions desired)
+%      or
+%    sampr         (double array, lists of response samples)
+%    descr         (cell array, list of response descriptions)
+%
+%  the required fields of dvar and dresp are:
+%    descriptor    (char, description)
+%    sample        (double vector, list of samples)
+%
+%  the optional input is:
+%    params        (string/numeric, parameter names and values)
+%
+%  where the optional parameters are:
+%    nplotr        (numeric, number of plot rows)
+%    nplotc        (numeric, number of plot columns)
+%    ymin          (numeric, minimum of y-axis)
+%    ymax          (numeric, maximum of y-axis)
+%    yscat         (char, 'off' to turn off y-axis scattergram)
+%
+%  for each variable/response combination in the input array, this
+%  function plots a line plot.  all of the variables and responses
+%  are plotted on the same axes, if nplotr and nplotc are not
+%  specified, so some scaling might otherwise be desired.
+%
+%  dvar and dresp data would typically be contained in the dakota
+%  tabular output file from a sampling or parametric analysis, and
+%  read by dakota_out_parse.
+%
+%  "Copyright 2009, by the California Institute of Technology.
+%  ALL RIGHTS RESERVED. United States Government Sponsorship
+%  acknowledged. Any commercial use must be negotiated with
+%  the Office of Technology Transfer at the California Institute
+%  of Technology.  (J. Schiermeier, NTR 47078)
+%
+%  This software may be subject to U.S. export control laws.
+%  By accepting this  software, the user agrees to comply with
+%  all applicable U.S. export laws and regulations. User has the
+%  responsibility to obtain export licenses, or other export
+%  authority as may be required before exporting such information
+%  to foreign countries or providing access to foreign persons."
+%
+function []=plot_rvsv_line(varargin)
+
+if ~nargin
+    help plot_rvsv_line
+    return
+end
+
+%%  process input data and assemble into matrices as needed
+
+%  variables
+
+iarg=1;
+if isstruct(varargin{iarg})
+    dvar=varargin{iarg};
+    iarg=iarg+1;
+    
+%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
+    if iarg <= nargin && iscell(varargin{iarg})
+        dvar=struc_desc(dvar,varargin{iarg});
+        iarg=iarg+1;
+    end
+    
+    descv=cell (1,length(dvar));
+    lsamp=zeros(1,length(dvar));
+    for i=1:length(dvar)
+        lsamp(i)=length(dvar(i).sample);
+    end
+    sampv=zeros(max(lsamp),length(dvar));
+    sampv(:,:)=NaN;
+
+    for i=1:length(dvar)
+        descv(i)=cellstr(dvar(i).descriptor);
+        sampv(1:lsamp(i),i)=dvar(i).sample;
+    end
+else
+    sampv=varargin{iarg};
+    iarg=iarg+1;
+    
+    if     iarg <= nargin && iscell(varargin{iarg})
+        descv=varargin{iarg};
+        iarg=iarg+1;
+%     elseif iarg <= nargin && ischar(varargin{iarg})
+%         descv=cellstr(varargin{iarg});
+%         iarg=iarg+1;
+    else
+        descv=cell(1,size(sampv,2));
+    end
+end
+
+for i=1:length(descv)
+    if isempty(descv{i})
+        descv(i)={['var_' i]};
+    end
+end
+
+%  responses
+
+if isstruct(varargin{iarg})
+    dresp=varargin{iarg};
+    iarg=iarg+1;
+    
+%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
+    if iarg <= nargin && iscell(varargin{iarg})
+        dresp=struc_desc(dresp,varargin{iarg});
+        iarg=iarg+1;
+    end
+    
+    descr=cell (1,length(dresp));
+    lsamp=zeros(1,length(dresp));
+    for i=1:length(dresp)
+        lsamp(i)=length(dresp(i).sample);
+    end
+    sampr=zeros(max(lsamp),length(dresp));
+    sampr(:,:)=NaN;
+
+    for i=1:length(dresp)
+        descr(i)=cellstr(dresp(i).descriptor);
+        sampr(1:lsamp(i),i)=dresp(i).sample;
+    end
+else
+    sampr=varargin{iarg};
+    iarg=iarg+1;
+    
+    if     iarg <= nargin && iscell(varargin{iarg})
+        descr=varargin{iarg};
+        iarg=iarg+1;
+%     elseif iarg <= nargin && ischar(varargin{iarg})
+%         descr=cellstr(varargin{iarg});
+%         iarg=iarg+1;
+    else
+        descr=cell(1,size(sampr,2));
+    end
+end
+
+for i=1:length(descr)
+    if isempty(descr{i})
+        descr(i)={['resp_' num2str(i)]};
+    end
+end
+
+%  parameters
+
+while (iarg <= nargin-1)
+    if ischar(varargin{iarg})
+        eval([varargin{iarg} '=varargin{iarg+1};']);
+        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
+    else
+        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
+    end
+    iarg=iarg+2;
+end
+    
+if     ~exist('nplotr','var') && ~exist('nplotc','var')
+    nplotr=1;
+    nplotc=1;
+elseif ~exist('nplotr','var')
+    nplotr=ceil(size(sampr,2)*size(sampv,2)/nplotc);
+elseif ~exist('nplotc','var')
+    nplotc=ceil(size(sampr,2)*size(sampv,2)/nplotr);
+end
+
+%%  filter, sort, and plot the data
+
+%  while it would be preferable for the outer loop to be responses,
+%  it is more efficient for the outer loop to be variables
+
+figure
+haxes=[];
+hplot=[];
+cdesc={};
+hscat=[];
+
+iplot=0;
+
+for ivar=1:size(sampv,2)
+    [vval,indxv,indxvi]=unique(sampv(:,ivar),'first');
+    indxv2=setdiff(1:size(sampv,1),indxv);
+
+    for iresp=1:size(sampr,2)
+
+%  initialize the subplot
+
+        if (ivar*iresp == 1) || ...
+           (nplotr*nplotc > 1)
+            iplot=iplot+1;
+            haxes(end+1)=subplot(nplotr,nplotc,iplot);
+            hold all
+        end
+
+        hplot(end+1)=plot   (sampv(indxv ,ivar),sampr(indxv ,iresp),'-x');
+        cdesc(end+1)={[descr{iresp} ' wrt ' descv{ivar}]};
+        if ~exist('yscat','var') || ~strcmpi(yscat,'off')
+            hscat(end+1)=scatter(sampv(indxv2,ivar),sampr(indxv2,iresp),'+k');
+%  see "controlling legends" in Matlab on-line docs
+%         cdesc(end+1)={['constant ' descv{ivar}]};
+            set(get(get(hscat(end),'Annotation'),'LegendInformation'),...
+                'IconDisplayStyle','off'); % Exclude line from legend
+        end
+        
+%  add the annotation
+
+        if (ivar*iresp == size(sampv,2)*size(sampr,2)) || ...
+           (nplotr*nplotc > 1)
+            hold off
+
+            ylim('auto')
+            [ylims]=ylim;
+            if exist('ymin','var')
+                ylims(1)=ymin;
+            end
+            if exist('ymax','var')
+                ylims(2)=ymax;
+            end
+            ylim(ylims)
+
+            if (size(sampv,2) == 1) || (nplotr*nplotc > 1)
+                xlabc=descv{ivar};
+            else
+                xlabc='Variables';
+            end
+            if (size(sampr,2) == 1) || (nplotr*nplotc > 1)
+                ylabc=descr{iresp};
+            else
+                ylabc='Responses';
+            end
+            title([ylabc ' vs. ' xlabc],'Interpreter','none');
+            xlabel(xlabc,'Interpreter','none');
+            ylabel(ylabc,'Interpreter','none');
+
+            if (nplotr*nplotc == 1) && (size(sampv,2)*size(sampr,2) > 1)
+                legend(cdesc,'Location','EastOutside','Interpreter','none');
+            end
+        end
+    end
+end
+
+end
Index: /issm/trunk/src/m/qmu/plot/plot_rvsv_scat3.m
===================================================================
--- /issm/trunk/src/m/qmu/plot/plot_rvsv_scat3.m	(revision 4763)
+++ /issm/trunk/src/m/qmu/plot/plot_rvsv_scat3.m	(revision 4763)
@@ -0,0 +1,273 @@
+%
+%  plot 3-d scatter plots of variables vs. responses.
+%
+%  []=plot_rvsv_scat3(dvar       ,dresp      ,params)
+%  []=plot_rvsv_scat3(dvar ,descv,dresp,descr,params)
+%  []=plot_rvsv_scat3(sampv,descv,sampr,descr,params)
+%
+%  where the required input is:
+%    dvar          (structure array, variables)
+%      or
+%    dvar          (structure array, variables)
+%    descv         (cell array, list of variable descriptions desired)
+%      or
+%    sampv         (double array, lists of variable samples)
+%    descv         (cell array, list of variable descriptions)
+%
+%    dresp         (structure array, responses)
+%      or
+%    dresp         (structure array, responses)
+%    descr         (cell array, list of response descriptions desired)
+%      or
+%    sampr         (double array, lists of response samples)
+%    descr         (cell array, list of response descriptions)
+%
+%  the required fields of dvar and dresp are:
+%    descriptor    (char, description)
+%    sample        (double vector, list of samples)
+%
+%  the optional input is:
+%    params        (string/numeric, parameter names and values)
+%
+%  where the optional parameters are:
+%    nplotr        (numeric, number of plot rows)
+%    nplotc        (numeric, number of plot columns)
+%    ymin          (numeric, minimum of y-axis)
+%    ymax          (numeric, maximum of y-axis)
+%    zmin          (numeric, minimum of z-axis)
+%    zmax          (numeric, maximum of z-axis)
+%    cmin          (numeric, minimum of colorbar)
+%    cmax          (numeric, maximum of colorbar)
+%    smark         (numeric, size of markers)
+%
+%  for each response in the input array, this function plots a 3-d
+%  scatter plot.  there should be no more than three variables.
+%  each response will be in a separate scatter plot; hence the
+%  need for nplotr and nplotc.
+%
+%  dvar and dresp data would typically be contained in the dakota
+%  tabular output file from a sampling or parametric analysis, and
+%  read by dakota_out_parse.
+%
+%  "Copyright 2009, by the California Institute of Technology.
+%  ALL RIGHTS RESERVED. United States Government Sponsorship
+%  acknowledged. Any commercial use must be negotiated with
+%  the Office of Technology Transfer at the California Institute
+%  of Technology.  (J. Schiermeier, NTR 47078)
+%
+%  This software may be subject to U.S. export control laws.
+%  By accepting this  software, the user agrees to comply with
+%  all applicable U.S. export laws and regulations. User has the
+%  responsibility to obtain export licenses, or other export
+%  authority as may be required before exporting such information
+%  to foreign countries or providing access to foreign persons."
+%
+function []=plot_rvsv_scat3(varargin)
+
+if ~nargin
+    help plot_rvsv_scat3
+    return
+end
+
+%%  process input data and assemble into matrices as needed
+
+iarg=1;
+
+%  variables
+
+if isstruct(varargin{iarg})
+    dvar=varargin{iarg};
+    iarg=iarg+1;
+    
+%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
+    if iarg <= nargin && iscell(varargin{iarg})
+        dvar=struc_desc(dvar,varargin{iarg});
+        iarg=iarg+1;
+    end
+    
+    descv=cell (1,length(dvar));
+    lsamp=zeros(1,length(dvar));
+    for i=1:length(dvar)
+        lsamp(i)=length(dvar(i).sample);
+    end
+    sampv=zeros(max(lsamp),length(dvar));
+    sampv(:,:)=NaN;
+
+    for i=1:length(dvar)
+        descv(i)=cellstr(dvar(i).descriptor);
+        sampv(1:lsamp(i),i)=dvar(i).sample;
+    end
+else
+    sampv=varargin{iarg};
+    iarg=iarg+1;
+    
+    if     iarg <= nargin && iscell(varargin{iarg})
+        descv=varargin{iarg};
+        iarg=iarg+1;
+%     elseif iarg <= nargin && ischar(varargin{iarg})
+%         descv=cellstr(varargin{iarg});
+%         iarg=iarg+1;
+    else
+        descv=cell(1,size(sampv,2));
+    end
+end
+
+for i=1:length(descv)
+    if isempty(descv{i})
+        descv(i)={['var_' i]};
+    end
+end
+
+if (size(sampv,2) > 3)
+    error('No more than three variables required for 3-d scatter plot.');
+end
+
+%  responses
+
+if isstruct(varargin{iarg})
+    dresp=varargin{iarg};
+    iarg=iarg+1;
+    
+%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
+    if iarg <= nargin && iscell(varargin{iarg})
+        dresp=struc_desc(dresp,varargin{iarg});
+        iarg=iarg+1;
+    end
+    
+    descr=cell (1,length(dresp));
+    lsamp=zeros(1,length(dresp));
+    for i=1:length(dresp)
+        lsamp(i)=length(dresp(i).sample);
+    end
+    sampr=zeros(max(lsamp),length(dresp));
+    sampr(:,:)=NaN;
+
+    for i=1:length(dresp)
+        descr(i)=cellstr(dresp(i).descriptor);
+        sampr(1:lsamp(i),i)=dresp(i).sample;
+    end
+else
+    sampr=varargin{iarg};
+    iarg=iarg+1;
+    
+    if     iarg <= nargin && iscell(varargin{iarg})
+        descr=varargin{iarg};
+        iarg=iarg+1;
+%     elseif iarg <= nargin && ischar(varargin{iarg})
+%         descr=cellstr(varargin{iarg});
+%         iarg=iarg+1;
+    else
+        descr=cell(1,size(sampr,2));
+    end
+end
+
+for i=1:length(descr)
+    if isempty(descr{i})
+        descr(i)={['resp_' num2str(i)]};
+    end
+end
+
+%  parameters
+
+while (iarg <= nargin-1)
+    if ischar(varargin{iarg})
+        eval([varargin{iarg} '=varargin{iarg+1};']);
+        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
+    else
+        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
+    end
+    iarg=iarg+2;
+end
+    
+if     ~exist('nplotr','var') && ~exist('nplotc','var')
+    nplotr=ceil(sqrt(size(sampr,2)));
+    nplotc=ceil(size(sampr,2)/nplotr);
+elseif ~exist('nplotr','var')
+    nplotr=ceil(size(sampr,2)/nplotc);
+elseif ~exist('nplotc','var')
+    nplotc=ceil(size(sampr,2)/nplotr);
+end
+
+if ~exist('smark','var')
+    smark=100;
+end
+
+%%  filter, sort, and plot the data
+
+figure
+haxes =[];
+hscat3=[];
+
+for iresp=1:size(sampr,2)
+    
+%  initialize the subplot
+
+    haxes(end+1)=subplot(nplotr,nplotc,iresp);
+    switch size(sampv,2)
+        case 1
+            hscat3(end+1)=scatter (sampv(:,1),sampr(:,iresp),...
+                                   smark,sampr(:,iresp),'filled');
+        case 2
+            hscat3(end+1)=scatter3(sampv(:,1),sampv(:,2),sampr(:,iresp),...
+                                   smark,sampr(:,iresp),'filled');
+        case 3
+            hscat3(end+1)=scatter3(sampv(:,1),sampv(:,2),sampv(:,3),...
+                                   smark,sampr(:,iresp),'filled');
+    end
+
+    ylim('auto')
+    [ylims]=ylim;
+    if exist('ymin','var')
+        ylims(1)=ymin;
+    end
+    if exist('ymax','var')
+        ylims(2)=ymax;
+    end
+    ylim(ylims)
+
+    zlim('auto')
+    [zlims]=zlim;
+    if exist('zmin','var')
+        zlims(1)=zmin;
+    end
+    if exist('zmax','var')
+        zlims(2)=zmax;
+    end
+    zlim(zlims)
+
+%  add the annotation
+
+    switch size(sampv,2)
+        case 1
+            title([descr{iresp} ' wrt ' descv{1}],...
+                  'Interpreter','none');
+            xlabel(descv{1},'Interpreter','none');
+            ylabel(descr{iresp},'Interpreter','none');
+        case 2
+            title([descr{iresp} ' wrt ' descv{1} ' and ' descv{2}],...
+                  'Interpreter','none');
+            xlabel(descv{1},'Interpreter','none');
+            ylabel(descv{2},'Interpreter','none');
+            zlabel(descr{iresp},'Interpreter','none');
+        case 3
+            title([descr{iresp} ' wrt ' descv{1} ' and ' descv{2} ' and ' descv{3}],...
+                  'Interpreter','none');
+            xlabel(descv{1},'Interpreter','none');
+            ylabel(descv{2},'Interpreter','none');
+            zlabel(descv{3},'Interpreter','none');
+    end
+
+    caxis('auto')
+    [cmini,cmaxi]=caxis;
+    if exist('cmin','var')
+        cmini=cmin;
+    end
+    if exist('cmax','var')
+        cmaxi=cmax;
+    end
+    caxis([cmini cmaxi])
+
+    colorbar
+end
+
+end
Index: /issm/trunk/src/m/qmu/plot/plot_rvsv_surf.m
===================================================================
--- /issm/trunk/src/m/qmu/plot/plot_rvsv_surf.m	(revision 4763)
+++ /issm/trunk/src/m/qmu/plot/plot_rvsv_surf.m	(revision 4763)
@@ -0,0 +1,240 @@
+%
+%  plot surface plots of variables vs. responses.
+%
+%  []=plot_rvsv_surf(dvar       ,dresp      ,params)
+%  []=plot_rvsv_surf(dvar ,descv,dresp,descr,params)
+%  []=plot_rvsv_surf(sampv,descv,sampr,descr,params)
+%
+%  where the required input is:
+%    dvar          (structure array, variables)
+%      or
+%    dvar          (structure array, variables)
+%    descv         (cell array, list of variable descriptions desired)
+%      or
+%    sampv         (double array, lists of variable samples)
+%    descv         (cell array, list of variable descriptions)
+%
+%    dresp         (structure array, responses)
+%      or
+%    dresp         (structure array, responses)
+%    descr         (cell array, list of response descriptions desired)
+%      or
+%    sampr         (double array, lists of response samples)
+%    descr         (cell array, list of response descriptions)
+%
+%  the required fields of dvar and dresp are:
+%    descriptor    (char, description)
+%    sample        (double vector, list of samples)
+%
+%  the optional input is:
+%    params        (string/numeric, parameter names and values)
+%
+%  where the optional parameters are:
+%    nplotr        (numeric, number of plot rows)
+%    nplotc        (numeric, number of plot columns)
+%    zmin          (numeric, minimum of z-axis)
+%    zmax          (numeric, maximum of z-axis)
+%    cmin          (numeric, minimum of colorbar)
+%    cmax          (numeric, maximum of colorbar)
+%
+%  for each response in the input array, this function plots a
+%  surface plot.  there should be two and only two variables.
+%  each response will be in a separate surface plot; hence the
+%  need for nplotr and nplotc.
+%
+%  dvar and dresp data would typically be contained in the dakota
+%  tabular output file from a sampling or parametric analysis, and
+%  read by dakota_out_parse.
+%
+%  "Copyright 2009, by the California Institute of Technology.
+%  ALL RIGHTS RESERVED. United States Government Sponsorship
+%  acknowledged. Any commercial use must be negotiated with
+%  the Office of Technology Transfer at the California Institute
+%  of Technology.  (J. Schiermeier, NTR 47078)
+%
+%  This software may be subject to U.S. export control laws.
+%  By accepting this  software, the user agrees to comply with
+%  all applicable U.S. export laws and regulations. User has the
+%  responsibility to obtain export licenses, or other export
+%  authority as may be required before exporting such information
+%  to foreign countries or providing access to foreign persons."
+%
+function []=plot_rvsv_surf(varargin)
+
+if ~nargin
+    help plot_rvsv_surf
+    return
+end
+
+%%  process input data and assemble into matrices as needed
+
+iarg=1;
+
+%  variables
+
+if isstruct(varargin{iarg})
+    dvar=varargin{iarg};
+    iarg=iarg+1;
+    
+%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
+    if iarg <= nargin && iscell(varargin{iarg})
+        dvar=struc_desc(dvar,varargin{iarg});
+        iarg=iarg+1;
+    end
+    
+    descv=cell (1,length(dvar));
+    lsamp=zeros(1,length(dvar));
+    for i=1:length(dvar)
+        lsamp(i)=length(dvar(i).sample);
+    end
+    sampv=zeros(max(lsamp),length(dvar));
+    sampv(:,:)=NaN;
+
+    for i=1:length(dvar)
+        descv(i)=cellstr(dvar(i).descriptor);
+        sampv(1:lsamp(i),i)=dvar(i).sample;
+    end
+else
+    sampv=varargin{iarg};
+    iarg=iarg+1;
+    
+    if     iarg <= nargin && iscell(varargin{iarg})
+        descv=varargin{iarg};
+        iarg=iarg+1;
+%     elseif iarg <= nargin && ischar(varargin{iarg})
+%         descv=cellstr(varargin{iarg});
+%         iarg=iarg+1;
+    else
+        descv=cell(1,size(sampv,2));
+    end
+end
+
+for i=1:length(descv)
+    if isempty(descv{i})
+        descv(i)={['var_' i]};
+    end
+end
+
+if (size(sampv,2) ~= 2)
+    error('Two and only two variables required for surface plot.');
+end
+
+%  responses
+
+if isstruct(varargin{iarg})
+    dresp=varargin{iarg};
+    iarg=iarg+1;
+    
+%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
+    if iarg <= nargin && iscell(varargin{iarg})
+        dresp=struc_desc(dresp,varargin{iarg});
+        iarg=iarg+1;
+    end
+    
+    descr=cell (1,length(dresp));
+    lsamp=zeros(1,length(dresp));
+    for i=1:length(dresp)
+        lsamp(i)=length(dresp(i).sample);
+    end
+    sampr=zeros(max(lsamp),length(dresp));
+    sampr(:,:)=NaN;
+
+    for i=1:length(dresp)
+        descr(i)=cellstr(dresp(i).descriptor);
+        sampr(1:lsamp(i),i)=dresp(i).sample;
+    end
+else
+    sampr=varargin{iarg};
+    iarg=iarg+1;
+    
+    if     iarg <= nargin && iscell(varargin{iarg})
+        descr=varargin{iarg};
+        iarg=iarg+1;
+%     elseif iarg <= nargin && ischar(varargin{iarg})
+%         descr=cellstr(varargin{iarg});
+%         iarg=iarg+1;
+    else
+        descr=cell(1,size(sampr,2));
+    end
+end
+
+for i=1:length(descr)
+    if isempty(descr{i})
+        descr(i)={['resp_' num2str(i)]};
+    end
+end
+
+%  parameters
+
+while (iarg <= nargin-1)
+    if ischar(varargin{iarg})
+        eval([varargin{iarg} '=varargin{iarg+1};']);
+        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
+    else
+        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
+    end
+    iarg=iarg+2;
+end
+    
+if     ~exist('nplotr','var') && ~exist('nplotc','var')
+    nplotr=ceil(sqrt(size(sampr,2)));
+    nplotc=ceil(size(sampr,2)/nplotr);
+elseif ~exist('nplotr','var')
+    nplotr=ceil(size(sampr,2)/nplotc);
+elseif ~exist('nplotc','var')
+    nplotc=ceil(size(sampr,2)/nplotr);
+end
+
+%%  filter, sort, and plot the data
+
+figure
+haxes=[];
+hsurf=[];
+
+[x,ix,ixi]=unique(sampv(:,1),'first');
+[y,iy,iyi]=unique(sampv(:,2),'first');
+
+for iresp=1:size(sampr,2)
+    z=zeros(length(x),length(y));
+    for i=1:size(sampr,1)
+        z(ixi(i),iyi(i))=sampr(i,iresp);
+    end
+    
+%  initialize the subplot
+
+    haxes(iresp)=subplot(nplotr,nplotc,iresp);
+%     hsurf(iresp)=surfc(x,y,z);
+    surfc(x,y,z);
+
+    zlim('auto')
+    [zlims]=zlim;
+    if exist('zmin','var')
+        zlims(1)=zmin;
+    end
+    if exist('zmax','var')
+        zlims(2)=zmax;
+    end
+    zlim(zlims)
+
+%  add the annotation
+
+    title([descr{iresp} ' wrt ' descv{1} ' and ' descv{2}],...
+          'Interpreter','none');
+    xlabel(descv{1},'Interpreter','none');
+    ylabel(descv{2},'Interpreter','none');
+    zlabel(descr{iresp},'Interpreter','none');
+
+    caxis('auto')
+    [cmini,cmaxi]=caxis;
+    if exist('cmin','var')
+        cmini=cmin;
+    end
+    if exist('cmax','var')
+        cmaxi=cmax;
+    end
+    caxis([cmini cmaxi])
+
+    colorbar
+end
+
+end
Index: /issm/trunk/src/m/qmu/plot/plot_sampdist_bars.m
===================================================================
--- /issm/trunk/src/m/qmu/plot/plot_sampdist_bars.m	(revision 4763)
+++ /issm/trunk/src/m/qmu/plot/plot_sampdist_bars.m	(revision 4763)
@@ -0,0 +1,205 @@
+%
+%  plot a stacked bar chart of the sample distributions.
+%
+%  []=plot_sampdist_bars(dresp      ,params)
+%  []=plot_sampdist_bars(dresp,descr,params)
+%  []=plot_sampdist_bars(sampr,descr,params)
+%
+%  where the required input is:
+%    dresp         (structure array, responses)
+%      or
+%    dresp         (structure array, responses)
+%    descr         (cell array, list of response descriptions desired)
+%      or
+%    sampr         (double array, lists of response samples)
+%    descr         (cell array, list of response descriptions)
+%
+%  the required fields of dresp are:
+%    descriptor    (char, description)
+%    sample        (double vector, list of samples)
+%
+%  and the optional fields of dresp are:
+%    min           (double, minimum of sample)
+%    quart1        (double, first quartile of sample)
+%    median        (double, median of sample)
+%    quart3        (double, third quartile of sample)
+%    max           (double, maximum of sample)
+%
+%  the optional input is:
+%    params        (string/numeric, parameter names and values)
+%
+%  where the optional parameters are:
+%    ymin          (numeric, minimum of y-axis)
+%    ymax          (numeric, maximum of y-axis)
+%    xtlrot        (numeric, rotation in degrees of x-tick labels)
+%    lstr          (cell array, legend labels)
+%
+%  for each response in the input array, this function plots
+%  a stacked bar plot of the list of samples, where the bars
+%  are stacked by the four quartiles, and annotates it with
+%  the description.  the quartiles will be calculated from the
+%  samples if they do not already exist.
+%
+%  this data would typically be contained in the dakota tabular
+%  output file and read by dakota_out_parse.
+%
+%  "Copyright 2009, by the California Institute of Technology.
+%  ALL RIGHTS RESERVED. United States Government Sponsorship
+%  acknowledged. Any commercial use must be negotiated with
+%  the Office of Technology Transfer at the California Institute
+%  of Technology.  (J. Schiermeier, NTR 47078)
+%
+%  This software may be subject to U.S. export control laws.
+%  By accepting this  software, the user agrees to comply with
+%  all applicable U.S. export laws and regulations. User has the
+%  responsibility to obtain export licenses, or other export
+%  authority as may be required before exporting such information
+%  to foreign countries or providing access to foreign persons."
+%
+function []=plot_sampdist_bars(varargin)
+
+if ~nargin
+    help plot_sampdist_bars
+    return
+end
+
+%%  process input data and assemble into dresp as needed
+
+%  responses
+
+iarg=1;
+if isstruct(varargin{iarg})
+    dresp=varargin{iarg};
+    iarg=iarg+1;
+    
+%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
+    if iarg <= nargin && iscell(varargin{iarg})
+        dresp=struc_desc(dresp,varargin{iarg});
+        iarg=iarg+1;
+    end
+else
+    sampr=varargin{iarg};
+    iarg=iarg+1;
+    
+    if     iarg <= nargin && iscell(varargin{iarg})
+        descr=varargin{iarg};
+        iarg=iarg+1;
+%     elseif iarg <= nargin && ischar(varargin{iarg})
+%         descr=cellstr(varargin{iarg});
+%         iarg=iarg+1;
+    else
+        descr=cell(1:size(sampr,2));
+    end
+    
+    dresp=struct([]);
+    for i=1:size(sampr,2)
+        dresp(end+1).sample=sampr(:,i);
+        if ~isempty(descr)
+            dresp(i).descriptor=descr{i};
+        else
+            dresp(i).descriptor=['dresp_' num2str(i)];
+        end
+    end
+end
+
+%  parameters
+
+while (iarg <= nargin-1)
+    if ischar(varargin{iarg})
+        eval([varargin{iarg} '=varargin{iarg+1};']);
+        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
+    else
+        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
+    end
+    iarg=iarg+2;
+end
+
+%%  calculate any missing information (noting that dresp is local)
+
+if ~isfield(dresp,'min')    || ~isfield(dresp,'quart1') || ...
+   ~isfield(dresp,'median') || ~isfield(dresp,'quart3') || ...
+   ~isfield(dresp,'max')
+    for i=1:length(dresp)
+        dresp(i).min   =min    (dresp(i).sample);
+        dresp(i).quart1=prctile(dresp(i).sample,25);
+        dresp(i).median=median (dresp(i).sample);
+        dresp(i).quart3=prctile(dresp(i).sample,75);
+        dresp(i).max   =max    (dresp(i).sample);
+    end
+end
+
+%%  assemble the data into a matrix and calculate the increments
+
+descr=cell (1,length(dresp));
+data =zeros(length(dresp),5);
+
+for i=1:length(dresp)
+    descr(i)=cellstr(dresp(i).descriptor);
+    data(i,1)=dresp(i).min;
+    data(i,2)=dresp(i).quart1-dresp(i).min;
+    data(i,3)=dresp(i).median-dresp(i).quart1;
+    data(i,4)=dresp(i).quart3-dresp(i).median;
+    data(i,5)=dresp(i).max   -dresp(i).quart3;
+end
+
+%%  draw the stacked bar plot
+
+%  if there's only one row, Matlab 7.5 interprets it as a column,
+%  so add an extra row, then reduce xlim
+
+if length(dresp) == 1
+    data=[data; data];
+end
+
+figure
+hl1=bar(data,'stacked');
+%  set barseries properties for lowest value
+whitebg('white')
+set(hl1(1),'FaceColor','white')
+set(hl1(1),'Visible','off')
+
+ax1=gca;
+if length(dresp) == 1
+    set(ax1,'xlim',[0.5 1.5])
+end
+
+ylim('auto')
+[ylims]=ylim;
+if exist('ymin','var')
+    ylims(1)=ymin;
+end
+if exist('ymax','var')
+    ylims(2)=ymax;
+end
+ylim(ylims)
+
+set(ax1,'xtick',1:length(descr))
+set(ax1,'xticklabel',descr)
+if exist('xtlrot','var')
+    htl=rotateticklabel(ax1,xtlrot);
+    tlext=zeros(length(htl),4);
+    for i=1:length(htl)
+        tlext(i,:)=get(htl(i),'Extent');
+    end
+end
+
+%  add the annotation
+
+title('Sample Distributions of Responses')
+xlabel('Response')
+if exist('xtlrot','var')
+    xlext=get(get(ax1,'xlabel'),'Extent');
+    nskip=ceil(max(tlext(:,4))/xlext(4));
+    xlabel(cellstr([repmat('        ',nskip,1);'Response']));
+    clear nskip xlext tlext
+end
+ylabel('Value')
+
+if ~exist('lstr','var') || isempty(lstr)
+    lstr={'minimum' 'quartile 1' 'median' 'quartile 3' 'maximum'};
+end
+
+hleg1=legend(ax1,lstr,'Location','EastOutside',...
+             'Orientation','vertical','Interpreter','none');
+
+end
Index: sm/trunk/src/m/qmu/plot_boxplot.m
===================================================================
--- /issm/trunk/src/m/qmu/plot_boxplot.m	(revision 4762)
+++ 	(revision )
@@ -1,145 +1,0 @@
-%
-%  plot a box plot of the responses.
-%
-%  []=plot_boxplot(dresp      ,params)
-%  []=plot_boxplot(dresp,descr,params)
-%  []=plot_boxplot(sampr,descr,params)
-%
-%  where the required input is:
-%    dresp         (structure array, responses)
-%      or
-%    dresp         (structure array, responses)
-%    descr         (cell array, list of response descriptions desired)
-%      or
-%    sampr         (double array, lists of response samples)
-%    descr         (cell array, list of response descriptions)
-%
-%  the required fields of dresp are:
-%    descriptor    (char, description)
-%    sample        (double vector, list of samples)
-%
-%  the optional input is:
-%    params        (string/numeric, parameter names and values)
-%
-%  where the optional parameters are:
-%    ymin          (numeric, minimum of y-axis)
-%    ymax          (numeric, maximum of y-axis)
-%
-%  for each response in the input array, this function plots a
-%  matlab box plot of the list of samples and annotates it
-%  with the description.  the lists of samples need not all be
-%  the same length.
-%
-%  this data would typically be contained in the dakota tabular
-%  output file and read by dakota_out_parse.
-%
-%  "Copyright 2009, by the California Institute of Technology.
-%  ALL RIGHTS RESERVED. United States Government Sponsorship
-%  acknowledged. Any commercial use must be negotiated with
-%  the Office of Technology Transfer at the California Institute
-%  of Technology.  (J. Schiermeier, NTR 47078)
-%
-%  This software may be subject to U.S. export control laws.
-%  By accepting this  software, the user agrees to comply with
-%  all applicable U.S. export laws and regulations. User has the
-%  responsibility to obtain export licenses, or other export
-%  authority as may be required before exporting such information
-%  to foreign countries or providing access to foreign persons."
-%
-function []=plot_boxplot(varargin)
-
-if ~nargin
-    help plot_boxplot
-    return
-end
-
-%%  process input data and assemble into matrices as needed
-
-%  responses
-
-iarg=1;
-if isstruct(varargin{iarg})
-    dresp=varargin{iarg};
-    iarg=iarg+1;
-    
-%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
-    if iarg <= nargin && iscell(varargin{iarg})
-        dresp=struc_desc(dresp,varargin{iarg});
-        iarg=iarg+1;
-    end
-    
-    descr=cell (1,length(dresp));
-    lsamp=zeros(1,length(dresp));
-    for i=1:length(dresp)
-        lsamp(i)=length(dresp(i).sample);
-    end
-    sampr=zeros(max(lsamp),length(dresp));
-    sampr(:,:)=NaN;
-
-    for i=1:length(dresp)
-        descr(i)=cellstr(dresp(i).descriptor);
-        sampr(1:lsamp(i),i)=dresp(i).sample;
-    end
-else
-    sampr=varargin{iarg};
-    iarg=iarg+1;
-    
-    if     iarg <= nargin && iscell(varargin{iarg})
-        descr=varargin{iarg};
-        iarg=iarg+1;
-%     elseif iarg <= nargin && ischar(varargin{iarg})
-%         descr=cellstr(varargin{iarg});
-%         iarg=iarg+1;
-    else
-        descr=cell(1,size(sampr,2));
-    end
-end
-
-for i=1:length(descr)
-    if isempty(descr{i})
-        descr(i)={['resp_' num2str(i)]};
-    end
-end
-
-%  parameters
-
-while (iarg <= nargin-1)
-    if ischar(varargin{iarg})
-        eval([varargin{iarg} '=varargin{iarg+1};']);
-        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
-    else
-        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
-    end
-    iarg=iarg+2;
-end
-    
-%%  draw the plot
-
-%  draw box plot
-
-figure
-boxplot(sampr,'labels',descr,'notch','on')
-ax1=gca;
-
-%  add the annotation
-
-ylim('auto')
-[ylims]=ylim;
-if exist('ymin','var')
-    ylims(1)=ymin;
-end
-if exist('ymax','var')
-    ylims(2)=ymax;
-end
-ylim(ylims)
-
-if (size(sampr,2) == 1)
-    tlabc=descr{1};
-else
-    tlabc='Responses';
-end
-title(['Box Plot of ' tlabc],'Interpreter','none');
-xlabel('Response','Interpreter','none');
-ylabel('Value'   ,'Interpreter','none');
-
-end
Index: sm/trunk/src/m/qmu/plot_hist_norm.m
===================================================================
--- /issm/trunk/src/m/qmu/plot_hist_norm.m	(revision 4762)
+++ 	(revision )
@@ -1,367 +1,0 @@
-%
-%  plot a relative histogram and cdf optionally along with
-%  a normal distribution.
-%
-%  []=plot_hist_norm(dresp1      ,dresp2      ,params)
-%  []=plot_hist_norm(dresp1,desc1,dresp2,desc2,params)
-%  []=plot_hist_norm(sampr ,descr,mu,sigma    ,params)
-%
-%  where the required input is:
-%    dresp1        (structure array, responses)
-%      or
-%    dresp1        (structure array, responses)
-%    desc1         (cell array, list of response descriptions desired)
-%      or
-%    sampr         (double array, lists of samples)
-%    descr         (cell array, list of descriptions)
-%
-%  and the optional input is:
-%    dresp2        (structure array, responses)
-%      or
-%    dresp2        (structure array, responses)
-%    desc2         (cell array, list of response descriptions desired)
-%      or
-%    mu            (double vector, means)
-%    sigma         (double vector, standard deviations)
-%
-%  the required fields of dresp1 are:
-%    descriptor    (char, description)
-%    sample        (double vector, list of samples)
-%
-%  and the required fields of dresp2 are:
-%    mean          (double, mean of sample)
-%    stddev        (double, standard deviation of sample)
-%
-%  the optional input is:
-%    params        (string/numeric, parameter names and values)
-%
-%  where the optional parameters are:
-%    hmin          (numeric, minimum for histogram)
-%    hmax          (numeric, maximum for histogram)
-%    hnint         (numeric, number of intervals for histogram)
-%    ymin1         (numeric, minimum of histogram y-axis)
-%    ymax1         (numeric, maximum of histogram y-axis)
-%    ymin2         (numeric, minimum of cdf y-axis)
-%    ymax2         (numeric, maximum of cdf y-axis)
-%    cdfplt        (char, 'off' to turn off cdf line plots)
-%    cdfleg        (char, 'off' to turn off cdf legends)
-%
-%  for each response in the input array, this function
-%  calculates and plots a relative histogram and CDF of the list
-%  of samples, and annotates it with the description.  in
-%  addition, a mean and standard deviation may be supplied or,
-%  if empty, calculated so that a normal distribution and CDF may
-%  be plotted.
-%
-%  dresp1 data would typically be contained in the dakota tabular
-%  output file from a sampling analysis, and dresp2 data would
-%  typically be contained in the dakota output file from a local
-%  sensitivity analysis, both read by dakota_out_parse.
-%
-%  "Copyright 2009, by the California Institute of Technology.
-%  ALL RIGHTS RESERVED. United States Government Sponsorship
-%  acknowledged. Any commercial use must be negotiated with
-%  the Office of Technology Transfer at the California Institute
-%  of Technology.  (J. Schiermeier, NTR 47078)
-%
-%  This software may be subject to U.S. export control laws.
-%  By accepting this  software, the user agrees to comply with
-%  all applicable U.S. export laws and regulations. User has the
-%  responsibility to obtain export licenses, or other export
-%  authority as may be required before exporting such information
-%  to foreign countries or providing access to foreign persons."
-%
-function []=plot_hist_norm(varargin)
-
-if ~nargin
-    help plot_hist_norm
-    return
-end
-
-%%  process input data and assemble into matrices as needed
-
-%  responses for histograms
-
-iarg=1;
-if isstruct(varargin{iarg})
-    dresp1=varargin{iarg};
-    iarg=iarg+1;
-    
-%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
-    if iarg <= nargin && iscell(varargin{iarg})
-        dresp1=struc_desc(dresp1,varargin{iarg});
-        iarg=iarg+1;
-    end
-    
-    descr=cell (1,length(dresp1));
-    lsamp=zeros(1,length(dresp1));
-    for i=1:length(dresp1)
-        lsamp(i)=length(dresp1(i).sample);
-    end
-    sampr=zeros(max(lsamp),length(dresp1));
-    sampr(:,:)=NaN;
-
-    for i=1:length(dresp1)
-        descr(i)=cellstr(dresp1(i).descriptor);
-        sampr(1:lsamp(i),i)=dresp1(i).sample;
-    end
-else
-    sampr=varargin{iarg};
-    iarg=iarg+1;
-    
-    lsamp(1:size(sampr,2))=size(sampr,1);
-
-    if     iarg <= nargin && iscell(varargin{iarg})
-        descr=varargin{iarg};
-        iarg=iarg+1;
-%     elseif iarg <= nargin && ischar(varargin{iarg})
-%         descr=cellstr(varargin{iarg});
-%         iarg=iarg+1;
-    else
-        descr=cell(1:size(sampr,2));
-    end
-end
-
-for i=1:length(descr)
-    if isempty(descr{i})
-        descr(i)={['resp_' num2str(i)]};
-    end
-end
-
-%  responses for normal distributions
-
-if     iarg <= nargin && isstruct(varargin{iarg})
-    dresp2=varargin{iarg};
-    iarg=iarg+1;
-
-%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
-    if iarg <= nargin && iscell(varargin{iarg})
-        dresp2=struc_desc(dresp2,varargin{iarg});
-        iarg=iarg+1;
-    end
-    
-    mu   =zeros(1,length(dresp2));
-    sigma=zeros(1,length(dresp2));
-
-    for i=1:length(dresp2)
-        mu   (i)=dresp2(i).mean;
-        sigma(i)=dresp2(i).stddev;
-    end
-elseif iarg+1 <= nargin && ...
-       isnumeric(varargin{iarg}) && isnumeric(varargin{iarg+1})
-    if ~isempty(varargin{iarg})
-        mu   =varargin{iarg};
-    else
-        mu   =mean(sampr);
-        display('Using calculated means.')
-    end
-    iarg=iarg+1;
-    if ~isempty(varargin{iarg})
-        sigma=varargin{iarg};
-    else
-        sigma=std(sampr);
-        display('Using calculated standard deviations.')
-    end
-    iarg=iarg+1;
-end
-
-%  parameters
-
-while (iarg <= nargin-1)
-    if ischar(varargin{iarg})
-        eval([varargin{iarg} '=varargin{iarg+1};']);
-        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
-    else
-        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
-    end
-    iarg=iarg+2;
-end
-
-%%  generate the intervals
-
-if ~exist('hmin','var')
-    hmin=min(min(sampr));
-end
-if ~exist('hmax','var')
-    hmax=max(max(sampr));
-end
-if ~exist('hnint','var')
-    hnint=50;
-end
-edges=hmin:(hmax-hmin)/hnint:hmax;
-
-%%  generate the histogram counts and make them relative
-
-%  note that for the histc function:
-%  n(k) counts the value x(i) if edges(k) <= x(i) < edges(k+1).
-%  The last bin counts any values of x that match edges(end).
-%  Values outside the values in edges are not counted.
-%  Use -inf and inf in edges to include all non-NaN values.
-
-dhistc=histc(sampr,edges);
-for i=1:size(sampr,2)
-    dbelow(i)  =length(find(sampr(:,i)<edges(  1)))/lsamp(i);
-    dhistc(:,i)=dhistc(:,i)                        /lsamp(i);
-    dabove(i)  =length(find(sampr(:,i)>edges(end)))/lsamp(i);
-end
-
-if exist('mu','var') && exist('sigma','var')
-    ncol=size(sampr,2);
-    for i=1:ncol
-        dbelow(ncol+i)=normcdf(edges(  1),mu(i),sigma(i));
-        dhistc(1:size(dhistc,1)-1,ncol+i)=...
-            normcdf(edges(2:end  ),mu(i),sigma(i))-...
-            normcdf(edges(1:end-1),mu(i),sigma(i));
-        dabove(ncol+i)=norminv(edges(end),mu(i),sigma(i));
-        if exist('descr','var')
-            descr(ncol+i)={[descr{i} ' norm']};
-        end
-    end
-end
-
-%  draw the bar plot
-
-figure
-hl1=bar(edges(1:end-1),dhistc(1:end-1,:));
-ax1=gca;
-
-%  set barseries properties for clarity
-
-if (length(hl1) > 1)
-    for i=1:length(hl1)
-        set(hl1(i),'BarWidth',1,'EdgeColor','none');
-    end
-end
-
-xlim('auto')
-[xlims]=xlim;
-if exist('hmin','var')
-    xlims(1)=edges(1);
-end
-if exist('hmax','var')
-    xlims(2)=edges(end-1);
-end
-xlim(xlims)
-
-ylim('auto')
-[ylims]=ylim;
-if exist('ymin1','var')
-    ylims(1)=ymin1;
-end
-if exist('ymax1','var')
-    ylims(2)=ymax1;
-end
-ylim(ylims)
-
-%  add the annotation
-
-if exist('cdfplt','var') && strcmpi(cdfplt,'off')
-    title('Relative Frequency Histogram')
-else
-    title('Relative Frequency Histogram with CDF')
-end
-xlabel('Interval Edge Value');
-ylabel('Relative Frequency');
-
-if exist('descr','var')
-    hleg1=legend(ax1,descr,'Location','NorthWest',...
-                 'Color','none','Interpreter','none');
-else
-    hleg1=legend(ax1);
-end
-
-%%  generate the cumulative distribution functions
-
-if ~exist('cdfplt','var') || ~strcmpi(cdfplt,'off')
-%     cdf=zeros(size(dhistc));
-%     cdf(1,:)=dhistc(1,:);
-%     for i=2:size(dhistc,1)
-%         cdf(i,:)=cdf(i-1,:)+dhistc(i,:);
-%     end
-    cdf=cumsum(dhistc);
-    for i=1:size(dhistc,2)
-        cdf(:,i)=dbelow(i)+cdf(:,i);
-    end
-    if exist('descr','var')
-        ncol=length(descr);
-        for i=1:ncol
-            cdescr(i)={[descr{i} ' cdf']};
-        end
-    end
-
-%  draw the line plot
-
-%  (see "Using Multiple X- and Y-Axes" and "Overlaying Other
-%  Plots on Bar Graphs", or search on "YAxisLocation right")
-
-%     hold all
-%     hold on
-%     plot(edges,cdf)
-%     plotyy([],[],edges,cdf)
-
-%  ticks from the bar plot will show through on the right side,
-%  so make equal number of ticks for the line plot on right side
-
-    nytick=length(get(ax1,'YTick'));
-%     ylim('auto')
-%     [ylims]=ylim;
-    [ylims]=[0 ceil(max(max(cdf))/0.1-0.1)*0.1];
-    if exist('ymin2','var')
-        ylims(1)=ymin2;
-    end
-    if exist('ymax2','var')
-        ylims(2)=ymax2;
-    else
-        ylims(2)=ylims(1)+(nytick-1)/(nytick-1-1)*(ylims(2)-ylims(1));
-    end
-%     ylim(ylims)
-    ytinc =(ylims(2)-ylims(1))/(nytick-1);
-
-    ax2=axes('Position',get(ax1,'Position'),...
-             'XLim',get(ax1,'XLim'),...
-             'XTick',get(ax1,'XTick'),...
-             'YLim',ylims,...
-             'YTick',[ylims(1):ytinc:ylims(2)],...
-             'XAxisLocation','bottom','YAxisLocation','right',...
-             'Color','none','Layer','top');
-    hl2=line(edges(1:end-1),cdf(1:end-1,:),'Parent',ax2);
-
-%  set line property colors to match barseries property
-%  (if barseries is "flat", must interpolate and round to colormap)
-
-    cmap=colormap;
-    for i=1:length(hl2)
-        if ischar(get(hl1(i),'FaceColor')) && ...
-           strcmpi(get(hl1(i),'FaceColor'),'flat')
-            if (length(hl2) > 1)
-                imap=round((i-1)/(length(hl2)-1)*(size(cmap,1)-1))+1;
-            else
-                imap=1;
-            end
-            set(hl2(i),'Color',cmap(imap,:))
-        else
-            set(hl2(i),'Color',get(hl1(i),'FaceColor'))
-        end
-    end
-
-%  add the annotation
-
-    ylabel('Cumulative Percent');
-
-    if ~exist('cdfleg','var') || ~strcmpi(cdfleg,'off')
-% legend doesn't combine with bar chart above
-        if exist('cdescr','var')
-            hleg2=legend(ax2,cdescr,'Location','NorthEast',...
-                         'Color','none','Interpreter','none');
-%             set(hleg2,'Color','white')
-        else
-            hleg2=legend(ax2);
-%             set(hleg2,'Color','white')
-        end
-    end
-
-    set(gcf,'PaperPositionMode','auto')
-%     hold off
-end
-
-end
Index: sm/trunk/src/m/qmu/plot_hist_norm_ci.m
===================================================================
--- /issm/trunk/src/m/qmu/plot_hist_norm_ci.m	(revision 4762)
+++ 	(revision )
@@ -1,455 +1,0 @@
-%
-%  plot a relative histogram and cdf optionally along with a
-%  normal distribution for the sample and confidence intervals.
-%
-%  []=plot_hist_norm_ci(dresp      ,params)
-%  []=plot_hist_norm_ci(dresp,descr,params)
-%  []=plot_hist_norm_ci(sampr,descr,params)
-%
-%  where the required input is:
-%    dresp         (structure array, responses)
-%      or
-%    dresp         (structure array, responses)
-%    descr         (cell array, list of response descriptions desired)
-%      or
-%    sampr         (double array, lists of samples)
-%    descr         (cell array, list of descriptions)
-%
-%  the required fields of dresp are:
-%    descriptor    (char, description)
-%    sample        (double vector, list of samples)
-%
-%  and the optional fields of dresp are:
-%    mean          (double, mean of sample)
-%    stddev        (double, standard deviation of sample)
-%    meanci(2)     (double, confidence interval of mean)
-%    stddevci(2)   (double, confidence interval of standard deviation)
-%
-%  the optional input is:
-%    params        (string/numeric, parameter names and values)
-%
-%  and the optional input is:
-%    hmin          (numeric, minimum for histogram)
-%    hmax          (numeric, maximum for histogram)
-%    hnint         (numeric, number of intervals for histogram)
-%    ymin1         (numeric, minimum of histogram y-axis)
-%    ymax1         (numeric, maximum of histogram y-axis)
-%    ymin2         (numeric, minimum of cdf y-axis)
-%    ymax2         (numeric, maximum of cdf y-axis)
-%    nrmplt        (char, 'line' or 'off' to change nrm plots from 'bar')
-%    ciplt         (char, 'line' or 'off' to change ci plots from 'bar')
-%    cdfplt        (char, 'off' to turn off cdf line plots)
-%    cdfleg        (char, 'off' to turn off cdf legends)
-%    cmap          (char or numeric, colormap definition)
-%
-%  for each response in the input array, this function
-%  calculates and plots a relative histogram and CDF of the list
-%  of samples, and annotates it with the description.  in
-%  addition, the normal distribution and CDF are plotted, and
-%  four CDF's are plotted for the confidence intervals.
-%
-%  dresp data would typically be contained in the dakota tabular
-%  output file from a sampling analysis, read by dakota_out_parse.
-%
-%  "Copyright 2009, by the California Institute of Technology.
-%  ALL RIGHTS RESERVED. United States Government Sponsorship
-%  acknowledged. Any commercial use must be negotiated with
-%  the Office of Technology Transfer at the California Institute
-%  of Technology.  (J. Schiermeier, NTR 47078)
-%
-%  This software may be subject to U.S. export control laws.
-%  By accepting this  software, the user agrees to comply with
-%  all applicable U.S. export laws and regulations. User has the
-%  responsibility to obtain export licenses, or other export
-%  authority as may be required before exporting such information
-%  to foreign countries or providing access to foreign persons."
-%
-function []=plot_hist_norm_ci(varargin)
-
-if ~nargin
-    help plot_hist_norm_ci
-    return
-end
-
-%%  process input data and assemble into matrices as needed
-
-iarg=1;
-if isstruct(varargin{iarg})
-    dresp=varargin{iarg};
-    iarg=iarg+1;
-    
-%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
-    if iarg <= nargin && iscell(varargin{iarg})
-        dresp=struc_desc(dresp,varargin{iarg});
-        iarg=iarg+1;
-    end
-    
-    descr=cell (1,length(dresp));
-    lsamp=zeros(1,length(dresp));
-    for i=1:length(dresp)
-        lsamp(i)=length(dresp(i).sample);
-    end
-    sampr=zeros(max(lsamp),length(dresp));
-    sampr(:,:)=NaN;
-    
-    mu     =zeros(1,length(dresp));
-    sigma  =zeros(1,length(dresp));
-    muci   =zeros(2,length(dresp));
-    sigmaci=zeros(2,length(dresp));
-
-    for i=1:length(dresp)
-        descr(i)=cellstr(dresp(i).descriptor);
-        sampr(1:lsamp(i),i)=dresp(i).sample;
-        mu     (i)  =dresp(i).mean;
-        sigma  (i)  =dresp(i).stddev;
-        muci   (:,i)=dresp(i).meanci;
-        sigmaci(:,i)=dresp(i).stddevci;
-    end
-else
-    sampr=varargin{iarg};
-    iarg=iarg+1;
-    
-    lsamp(1:size(sampr,2))=size(sampr,1);
-
-    if     iarg <= nargin && iscell(varargin{iarg})
-        descr=varargin{iarg};
-        iarg=iarg+1;
-%     elseif iarg <= nargin && ischar(varargin{iarg})
-%         descr=cellstr(varargin{iarg});
-%         iarg=iarg+1;
-    else
-        descr=cell(1,size(sampr,2));
-    end
-    
-    mu     =zeros(1,size(sampr,2));
-    sigma  =zeros(1,size(sampr,2));
-    muci   =zeros(2,size(sampr,2));
-    sigmaci=zeros(2,size(sampr,2));
-    for i=1:size(sampr,2)
-%  calculate 95% confidence intervals (same as dakota)
-        [mu(i),sigma(i),muci(:,i),sigmaci(:,i)]=...
-            normfit(sampr(:,i),0.05);
-    end
-    display('Using calculated normal fits.')
-end
-
-for i=1:length(descr)
-    if isempty(descr{i})
-        descr(i)={['resp_' num2str(i)]};
-    end
-end
-
-%  parameters
-
-while (iarg <= nargin-1)
-    if ischar(varargin{iarg})
-        eval([varargin{iarg} '=varargin{iarg+1};']);
-        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
-    else
-        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
-    end
-    iarg=iarg+2;
-end
-
-%%  generate the intervals
-
-if ~exist('hmin','var')
-    hmin=min(min(sampr));
-end
-if ~exist('hmax','var')
-    hmax=max(max(sampr));
-end
-if ~exist('hnint','var')
-    hnint=50;
-end
-edges=hmin:(hmax-hmin)/hnint:hmax;
-
-%%  generate the histogram counts and make them relative
-
-%  note that for the histc function:
-%  n(k) counts the value x(i) if edges(k) <= x(i) < edges(k+1).
-%  The last bin counts any values of x that match edges(end).
-%  Values outside the values in edges are not counted.
-%  Use -inf and inf in edges to include all non-NaN values.
-
-dhistc=histc(sampr,edges);
-for i=1:size(sampr,2)
-    dbelow(i)  =length(find(sampr(:,i)<edges(  1)))/lsamp(i);
-    dhistc(:,i)=dhistc(:,i)                        /lsamp(i);
-    dabove(i)  =length(find(sampr(:,i)>edges(end)))/lsamp(i);
-end
-
-if exist('mu','var') && exist('sigma','var')
-    ncol=size(sampr,2);
-    for i=1:ncol
-        dbelow(end+1)=normcdf(edges(  1),mu(i),sigma(i));
-        dhistc(1:size(dhistc,1)-1,end+1)=...
-            normcdf(edges(2:end  ),mu(i),sigma(i))-...
-            normcdf(edges(1:end-1),mu(i),sigma(i));
-        dabove(end+1)=norminv(edges(end),mu(i),sigma(i));
-        if exist('descr','var')
-            descr(end+1)={[descr{i} ' norm']};
-        end
-    end
-end
-
-if exist('muci','var') && exist('sigmaci','var')
-    for i=1:ncol
-        dbelow(end+1)=normcdf(edges(  1),muci(1,i),sigmaci(2,i));
-        dhistc(1:size(dhistc,1)-1,end+1)=...
-            normcdf(edges(2:end  ),muci(1,i),sigmaci(2,i))-...
-            normcdf(edges(1:end-1),muci(1,i),sigmaci(2,i));
-        dabove(end+1)=norminv(edges(end),muci(1,i),sigmaci(2,i));
-        if exist('descr','var')
-            descr(end+1)={[descr{i} ' norm-+']};
-        end
-    end
-    for i=1:ncol
-        dbelow(end+1)=normcdf(edges(  1),muci(1,i),sigmaci(1,i));
-        dhistc(1:size(dhistc,1)-1,end+1)=...
-            normcdf(edges(2:end  ),muci(1,i),sigmaci(1,i))-...
-            normcdf(edges(1:end-1),muci(1,i),sigmaci(1,i));
-        dabove(end+1)=norminv(edges(end),muci(1,i),sigmaci(1,i));
-        if exist('descr','var')
-            descr(end+1)={[descr{i} ' norm--']};
-        end
-    end
-    for i=1:ncol
-        dbelow(end+1)=normcdf(edges(  1),muci(2,i),sigmaci(1,i));
-        dhistc(1:size(dhistc,1)-1,end+1)=...
-            normcdf(edges(2:end  ),muci(2,i),sigmaci(1,i))-...
-            normcdf(edges(1:end-1),muci(2,i),sigmaci(1,i));
-        dabove(end+1)=norminv(edges(end),muci(2,i),sigmaci(1,i));
-        if exist('descr','var')
-            descr(end+1)={[descr{i} ' norm+-']};
-        end
-    end
-    for i=1:ncol
-        dbelow(end+1)=normcdf(edges(  1),muci(2,i),sigmaci(2,i));
-        dhistc(1:size(dhistc,1)-1,end+1)=...
-            normcdf(edges(2:end  ),muci(2,i),sigmaci(2,i))-...
-            normcdf(edges(1:end-1),muci(2,i),sigmaci(2,i));
-        dabove(end+1)=norminv(edges(end),muci(2,i),sigmaci(2,i));
-        if exist('descr','var')
-            descr(end+1)={[descr{i} ' norm++']};
-        end
-    end
-end
-
-%  draw the bar plot
-
-figure
-if ~exist('nrmplt','var')
-    nrmplt='bar';
-end
-if ~exist('ciplt','var')
-    ciplt='bar';
-end
-
-hold all
-% hl1=bar(edges(1:end-1),dhistc(1:end-1,1:6*ncol));
-% hl1=line(edges(1:end-1),dhistc(1:end-1,1:6*ncol));
-if     strcmpi(nrmplt,'bar')
-    if     strcmpi(ciplt,'bar')
-        hl1=bar (edges(1:end-1),dhistc(1:end-1,1:6*ncol));
-    elseif strcmpi(ciplt,'line')
-        hl1=bar (edges(1:end-1),dhistc(1:end-1,1:2*ncol));
-        hl1(2*ncol+1:6*ncol)=...
-            line(edges(1:end-1),dhistc(1:end-1,2*ncol+1:6*ncol),...
-                 'LineWidth',2);
-    elseif strcmpi(ciplt,'off')
-        hl1=bar (edges(1:end-1),dhistc(1:end-1,1:2*ncol));
-    end
-elseif strcmpi(nrmplt,'line')
-    if     strcmpi(ciplt,'bar') || strcmpi(ciplt,'line')
-        hl1=bar (edges(1:end-1),dhistc(1:end-1,1:1*ncol));
-        hl1(1*ncol+1:2*ncol)=...
-            line(edges(1:end-1),dhistc(1:end-1,1*ncol+1:2*ncol),...
-                 'LineWidth',2);
-        hl1(2*ncol+1:6*ncol)=...
-            line(edges(1:end-1),dhistc(1:end-1,2*ncol+1:6*ncol),...
-                 'LineWidth',1);
-    elseif strcmpi(ciplt,'off')
-        hl1=bar (edges(1:end-1),dhistc(1:end-1,1:1*ncol));
-        hl1(1*ncol+1:2*ncol)=...
-            line(edges(1:end-1),dhistc(1:end-1,1*ncol+1:2*ncol),...
-                 'LineWidth',2);
-    end
-elseif strcmpi(nrmplt,'off')
-    hl1=bar (edges(1:end-1),dhistc(1:end-1,1:1*ncol));
-end
-ax1=gca;
-hold off
-
-%  set barseries properties for clarity
-
-if (length(hl1) > 1)
-    for i=1:length(hl1)
-        if strcmpi(get(hl1(i),'Type'),'hggroup')
-            set(hl1(i),'BarWidth',1,'EdgeColor','none');
-        end
-    end
-end
-
-%  set bars and lines to have a continuous colormap
-%  (if barseries is "flat", must interpolate and round to colormap)
-
-if exist('cmap','var')
-    colormap(cmap)
-end
-
-cmap=colormap;
-for i=1:length(hl1)
-    if (length(hl1) > 1)
-        imap=round((i-1)/(length(hl1)-1)*(size(cmap,1)-1))+1;
-    else
-        imap=1;
-    end
-    if     strcmpi(get(hl1(i),'Type'),'hggroup')
-        if ischar(get(hl1(i),'FaceColor')) && ...
-           strcmpi(get(hl1(i),'FaceColor'),'flat')
-            set(hl1(i),'FaceColor',cmap(imap,:))
-        else
-            set(hl1(i),'FaceColor',get(hl1(i),'FaceColor'))
-        end
-    elseif strcmpi(get(hl1(i),'Type'),'line')
-        set(hl1(i),'Color',cmap(imap,:))
-    end
-end
-    
-xlim('auto')
-[xlims]=xlim;
-if exist('hmin','var')
-    xlims(1)=edges(1);
-end
-if exist('hmax','var')
-    xlims(2)=edges(end-1);
-end
-xlim(xlims)
-
-ylim('auto')
-[ylims]=ylim;
-if exist('ymin1','var')
-    ylims(1)=ymin1;
-end
-if exist('ymax1','var')
-    ylims(2)=ymax1;
-end
-ylim(ylims)
-
-%  add the annotation
-
-if exist('cdfplt','var') && strcmpi(cdfplt,'off')
-    title('Relative Frequency Histogram')
-else
-    title('Relative Frequency Histogram with CDF')
-end
-xlabel('Interval Edge Value');
-ylabel('Relative Frequency');
-
-if exist('descr','var')
-    hleg1=legend(ax1,descr(1:length(hl1)),'Location','NorthWest',...
-                 'Color','none','Interpreter','none');
-else
-    hleg1=legend(ax1);
-end
-
-%%  generate the cumulative distribution functions
-
-if ~exist('cdfplt','var') || ~strcmpi(cdfplt,'off')
-%     cdf=zeros(size(dhistc));
-%     cdf(1,:)=dhistc(1,:);
-%     for i=2:size(dhistc,1)
-%         cdf(i,:)=cdf(i-1,:)+dhistc(i,:);
-%     end
-    cdf=cumsum(dhistc);
-    for i=1:size(dhistc,2)
-        cdf(:,i)=dbelow(i)+cdf(:,i);
-    end
-    if exist('descr','var')
-        ncol=length(descr);
-        for i=1:ncol
-            cdescr(i)={[descr{i} ' cdf']};
-        end
-    end
-
-%  draw the line plot
-
-%  (see "Using Multiple X- and Y-Axes" and "Overlaying Other
-%  Plots on Bar Graphs", or search on "YAxisLocation right")
-
-%     hold all
-%     hold on
-%     plot(edges,cdf)
-%     plotyy([],[],edges,cdf)
-
-%  ticks from the bar plot will show through on the right side,
-%  so make equal number of ticks for the line plot on right side
-
-    nytick=length(get(ax1,'YTick'));
-%     ylim('auto')
-%     [ylims]=ylim;
-    [ylims]=[0 ceil(max(max(cdf))/0.1-0.1)*0.1];
-    if exist('ymin2','var')
-        ylims(1)=ymin2;
-    end
-    if exist('ymax2','var')
-        ylims(2)=ymax2;
-    else
-        ylims(2)=ylims(1)+(nytick-1)/(nytick-1-1)*(ylims(2)-ylims(1));
-    end
-%     ylim(ylims)
-    ytinc =(ylims(2)-ylims(1))/(nytick-1);
-
-    ax2=axes('Position',get(ax1,'Position'),...
-             'XLim',get(ax1,'XLim'),...
-             'XTick',get(ax1,'XTick'),...
-             'YLim',ylims,...
-             'YTick',[ylims(1):ytinc:ylims(2)],...
-             'XAxisLocation','bottom','YAxisLocation','right',...
-             'Color','none','Layer','top');
-    hl2=line(edges(1:end-1),cdf(1:end-1,1:length(hl1)),'Parent',ax2);
-
-%  set line property colors to match barseries or line property
-%  (if barseries is "flat", must interpolate and round to colormap)
-
-    cmap=colormap;
-    for i=1:length(hl2)
-        if (length(hl2) > 1)
-            imap=round((i-1)/(length(hl2)-1)*(size(cmap,1)-1))+1;
-        else
-            imap=1;
-        end
-        if     strcmpi(get(hl1(i),'Type'),'hggroup')
-            if ischar(get(hl1(i),'FaceColor')) && ...
-               strcmpi(get(hl1(i),'FaceColor'),'flat')
-                set(hl2(i),'Color',cmap(imap,:))
-            else
-                set(hl2(i),'Color',get(hl1(i),'FaceColor'))
-            end
-        elseif strcmpi(get(hl1(i),'Type'),'line')
-            set(hl2(i),'Color',get(hl1(i),'Color'))
-        end
-    end
-
-%  add the annotation
-
-    ylabel('Cumulative Percent');
-
-    if ~exist('cdfleg','var') || ~strcmpi(cdfleg,'off')
-% legend doesn't combine with bar chart above
-        if exist('cdescr','var')
-            hleg2=legend(ax2,cdescr(1:length(hl2)),'Location','NorthEast',...
-                         'Color','none','Interpreter','none');
-%             set(hleg2,'Color','white')
-        else
-            hleg2=legend(ax2);
-%             set(hleg2,'Color','white')
-        end
-    end
-
-    set(gcf,'PaperPositionMode','auto')
-%     hold off
-end
-
-end
Index: sm/trunk/src/m/qmu/plot_if_bars.m
===================================================================
--- /issm/trunk/src/m/qmu/plot_if_bars.m	(revision 4762)
+++ 	(revision )
@@ -1,223 +1,0 @@
-%
-%  plot a stacked bar chart of the importance factors.
-%
-%  []=plot_if_bars(dresp      ,params)
-%  []=plot_if_bars(dresp,descr,params)
-%
-%  where the required input is:
-%    dresp         (structure array, responses)
-%      or
-%    dresp         (structure array, responses)
-%    descr         (cell array, list of response descriptions desired)
-%
-%  the required fields of dresp are:
-%    descriptor    (char, description)
-%    var           (cell array, variables)
-%    impfac        (double array, importance factors)
-%
-%  the optional input is:
-%    params        (string/numeric, parameter names and values)
-%
-%  where the optional parameters are:
-%    ymin          (numeric, minimum of y-axis)
-%    ymax          (numeric, maximum of y-axis)
-%    ifmin         (double, minimum importance factor)
-%    isort         (numeric, sort flag:  0, no sorting;
-%                                        1, highest at bottom;
-%                                       -1, lowest at bottom)
-%    xtlrot        (numeric, rotation in degrees of x-tick labels)
-%
-%  for each response in the input array, this function plots
-%  a stacked bar plot of the responses, where the bars are
-%  stacked by the importance factors, and annotates it with the
-%  description.  the legend labels are constructed from the
-%  variable list.
-%
-%  this data would typically be contained in the dakota output
-%  file from a local reliability analysis and read by
-%  dakota_out_parse.
-%
-%  "Copyright 2009, by the California Institute of Technology.
-%  ALL RIGHTS RESERVED. United States Government Sponsorship
-%  acknowledged. Any commercial use must be negotiated with
-%  the Office of Technology Transfer at the California Institute
-%  of Technology.  (J. Schiermeier, NTR 47078)
-%
-%  This software may be subject to U.S. export control laws.
-%  By accepting this  software, the user agrees to comply with
-%  all applicable U.S. export laws and regulations. User has the
-%  responsibility to obtain export licenses, or other export
-%  authority as may be required before exporting such information
-%  to foreign countries or providing access to foreign persons."
-%
-function []=plot_if_bars(varargin)
-
-if ~nargin
-    help plot_if_bars
-    return
-end
-
-%%  process input data and assemble into matrices
-
-%  responses
-
-iarg=1;
-if isstruct(varargin{iarg})
-    dresp=varargin{iarg};
-    iarg=iarg+1;
-    
-%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
-    if iarg <= nargin && iscell(varargin{iarg})
-        dresp=struc_desc(dresp,varargin{iarg});
-        iarg=iarg+1;
-    end
-    
-    descr=cell (1,length(dresp));
-    lifr =zeros(1,length(dresp));
-    for i=1:length(dresp)
-        lifr(i)=length(dresp(i).impfac);
-    end
-    ifr =zeros(length(dresp),max(lifr));
-    dvar=dresp(find(lifr == max(lifr),1,'first')).var;
-
-    for i=1:length(dresp)
-        descr(i)=cellstr(dresp(i).descriptor);
-        ifr(i,1:lifr(i))=dresp(i).impfac;
-    end
-else
-    error(['''' inputname(iarg) ''' is not a structure.']);
-end
-
-%  parameters
-
-while (iarg <= nargin-1)
-    if ischar(varargin{iarg})
-        eval([varargin{iarg} '=varargin{iarg+1};']);
-        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
-    else
-        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
-    end
-    iarg=iarg+2;
-end
-
-if ~exist('ifmin','var') || isempty(ifmin)
-    ifmin=0;
-end
-
-if ~exist('isort','var') || isempty(isort)
-    isort=0;
-end
-
-%%  sort the data, if necessary
-
-if (isort)
-    ifmean=mean(ifr,1);
-    if (isort > 0)
-        [ifmean,index]=sort(ifmean,'descend');
-    else
-        [ifmean,index]=sort(ifmean,'ascend' );
-    end
-    clear ifmean
-    
-    dvar=dvar(index);
-    ifr =ifr (:,index);
-end
-
-%%  filter the data, if necessary
-
-if (ifmin > 0)
-    nif=length(dvar);
-    dvar(nif+1,1)=cellstr(sprintf('others < %f',ifmin));
-    ifr (:,nif+1)=0.;
-    
-    nif2=0;
-    dvar2=cell (size(dvar));
-    ifr2 =zeros(size(ifr ));
-    
-%  sum filtered rows and copy unfiltered rows
-
-    for i=1:nif
-        if (max(ifr(:,i)) < ifmin)
-            ifr(:,nif+1)=ifr(:,nif+1)+ifr(:,i);
-        else
-            nif2=nif2+1;
-            dvar2(nif2)  =dvar(i);
-            ifr2 (:,nif2)=ifr (:,i);
-        end
-    end
-    
-%  copy sums
-
-    dvar2(nif2+1)  =dvar(nif+1);
-    ifr2 (:,nif2+1)=ifr (:,nif+1);
-    
-%  copy back and truncate filtered rows
-
-    clear dvar ifr
-    if (isort >= 0)
-        dvar(1:nif2+1)  =dvar2(1:nif2+1);
-        ifr (:,1:nif2+1)=ifr2 (:,1:nif2+1);
-    else
-        dvar(1       )  =dvar2(  nif2+1);
-        dvar(2:nif2+1)  =dvar2(1:nif2  );
-        ifr (:,1       )=ifr2 (:,  nif2+1);
-        ifr (:,2:nif2+1)=ifr2 (:,1:nif2  );
-    end
-    clear nif nif2 dvar2 ifr2
-end
-
-%%  draw the stacked bar plot
-
-%  if there's only one row, Matlab 7.5 interprets it as a column,
-%  so add an extra row, then reduce xlim
-
-if length(dresp) == 1
-    ifr=[ifr; ifr];
-end
-
-figure
-hl1=bar(ifr,'stacked');
-
-ax1=gca;
-if length(dresp) == 1
-    set(ax1,'xlim',[0.5 1.5])
-end
-
-% set(ax1,'ylim',[0 1.2])
-% ylim('auto')
-% [ylims]=ylim;
-[ylims]=[0 1.2];
-if exist('ymin','var')
-    ylims(1)=ymin;
-end
-if exist('ymax','var')
-    ylims(2)=ymax;
-end
-ylim(ylims)
-
-set(ax1,'xtick',1:length(descr))
-set(ax1,'xticklabel',descr)
-if exist('xtlrot','var')
-    htl=rotateticklabel(ax1,xtlrot);
-    tlext=zeros(length(htl),4);
-    for i=1:length(htl)
-        tlext(i,:)=get(htl(i),'Extent');
-    end
-end
-
-%  add the annotation
-
-title('Importance Factors')
-xlabel('Response')
-if exist('xtlrot','var')
-    xlext=get(get(ax1,'xlabel'),'Extent');
-    nskip=ceil(max(tlext(:,4))/xlext(4));
-    xlabel(cellstr([repmat('        ',nskip,1);'Response']));
-    clear nskip xlext tlext
-end
-ylabel('Importance Factor Value')
-
-hleg1=legend(ax1,dvar,'Location','EastOutside',...
-             'Orientation','vertical','Interpreter','none');
-
-end
Index: sm/trunk/src/m/qmu/plot_normdist_bars.m
===================================================================
--- /issm/trunk/src/m/qmu/plot_normdist_bars.m	(revision 4762)
+++ 	(revision )
@@ -1,207 +1,0 @@
-%
-%  plot a stacked bar chart of the sample distributions.
-%
-%  []=plot_normdist_bars(dresp      ,params)
-%  []=plot_normdist_bars(dresp,descr,params)
-%  []=plot_normdist_bars(sampr,descr,params)
-%
-%  where the required input is:
-%    dresp         (structure array, responses)
-%      or
-%    dresp         (structure array, responses)
-%    descr         (cell array, list of response descriptions desired)
-%      or
-%    sampr         (double array, lists of response samples)
-%    descr         (cell array, list of response descriptions)
-%
-%  the required fields of dresp are:
-%    descriptor    (char, description)
-%    sample        (double vector, list of samples)
-%
-%  and the optional fields of dresp are:
-%    mean          (double, mean of sample)
-%    stddev        (double, standard deviation of sample)
-%
-%  the optional input is:
-%    params        (string/numeric, parameter names and values)
-%
-%  where the optional parameters are:
-%    prob          (double vector, probability levels)
-%    ymin          (numeric, minimum of y-axis)
-%    ymax          (numeric, maximum of y-axis)
-%    xtlrot        (numeric, rotation in degrees of x-tick labels)
-%    lstr          (cell array, legend labels)
-%
-%  for each response in the input array, this function plots
-%  a stacked bar plot of the list of samples, where the bars
-%  are stacked by the given or default probability levels
-%  calculated from a normal distribution, and annotates it with
-%  the description.  the mean and standard deviation will be
-%  calculated from the samples if they do not already exist.
-%  the legend labels can be given or constructed from the
-%  probability levels.
-%
-%  this data would typically be contained in the dakota tabular
-%  output file and read by dakota_out_parse.
-%
-%  "Copyright 2009, by the California Institute of Technology.
-%  ALL RIGHTS RESERVED. United States Government Sponsorship
-%  acknowledged. Any commercial use must be negotiated with
-%  the Office of Technology Transfer at the California Institute
-%  of Technology.  (J. Schiermeier, NTR 47078)
-%
-%  This software may be subject to U.S. export control laws.
-%  By accepting this  software, the user agrees to comply with
-%  all applicable U.S. export laws and regulations. User has the
-%  responsibility to obtain export licenses, or other export
-%  authority as may be required before exporting such information
-%  to foreign countries or providing access to foreign persons."
-%
-function []=plot_normdist_bars(varargin)
-
-if ~nargin
-    help plot_normdist_bars
-    return
-end
-
-%%  process input data and assemble into dresp as needed
-
-%  responses
-
-iarg=1;
-if isstruct(varargin{iarg})
-    dresp=varargin{iarg};
-    iarg=iarg+1;
-    
-%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
-    if iarg <= nargin && iscell(varargin{iarg})
-        dresp=struc_desc(dresp,varargin{iarg});
-        iarg=iarg+1;
-    end
-else
-    sampr=varargin{iarg};
-    iarg=iarg+1;
-    
-    if     iarg <= nargin && iscell(varargin{iarg})
-        descr=varargin{iarg};
-        iarg=iarg+1;
-%     elseif iarg <= nargin && ischar(varargin{iarg})
-%         descr=cellstr(varargin{iarg});
-%         iarg=iarg+1;
-    else
-        descr=cell(1:size(sampr,2));
-    end
-    
-    dresp=struct([]);
-    for i=1:size(sampr,2)
-        dresp(end+1).sample=samp(:,i);
-        if ~isempty(descr)
-            dresp(i).descriptor=descr{i};
-        else
-            dresp(i).descriptor=['dresp_' num2str(i)];
-        end
-    end
-end
-
-%  parameters
-
-while (iarg <= nargin-1)
-    if ischar(varargin{iarg})
-        eval([varargin{iarg} '=varargin{iarg+1};']);
-        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
-    else
-        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
-    end
-    iarg=iarg+2;
-end
-
-%%  calculate any missing information (noting that dresp is local)
-
-if ~isfield(dresp,'mean') || ~isfield(dresp,'stddev')
-    for i=1:length(dresp)
-        [dresp(i).mean,dresp(i).stddev]=normfit(dresp(i).sample);
-    end
-end
-
-%%  assemble the data into a matrix and calculate the increments
-
-if ~exist('prob','var') || isempty(prob)
-    prob=[0.01 0.25 0.50 0.75 0.99];
-end
-
-descr=cell (1,length(dresp));
-data =zeros(length(dresp),length(prob));
-
-for i=1:length(dresp)
-    descr(i)=cellstr(dresp(i).descriptor);
-    data(i,:)=norminv(prob,dresp(i).mean,dresp(i).stddev);
-end
-
-for j=length(prob):-1:2
-    data(:,j)=data(:,j)-data(:,j-1);
-end
-
-%%  draw the stacked bar plot
-
-%  if there's only one row, Matlab 7.5 interprets it as a column,
-%  so add an extra row, then reduce xlim
-
-if length(dresp) == 1
-    data=[data; data];
-end
-
-figure
-hl1=bar(data,'stacked');
-%  set barseries properties for lowest value
-whitebg('white')
-set(hl1(1),'FaceColor','white')
-set(hl1(1),'Visible','off')
-
-ax1=gca;
-if length(dresp) == 1
-    set(ax1,'xlim',[0.5 1.5])
-end
-
-ylim('auto')
-[ylims]=ylim;
-if exist('ymin','var')
-    ylims(1)=ymin;
-end
-if exist('ymax','var')
-    ylims(2)=ymax;
-end
-ylim(ylims)
-
-set(ax1,'xtick',1:length(descr))
-set(ax1,'xticklabel',descr)
-if exist('xtlrot','var')
-    htl=rotateticklabel(ax1,xtlrot);
-    tlext=zeros(length(htl),4);
-    for i=1:length(htl)
-        tlext(i,:)=get(htl(i),'Extent');
-    end
-end
-
-%  add the annotation
-
-title('Normal Distributions of Responses')
-xlabel('Response')
-if exist('xtlrot','var')
-    xlext=get(get(ax1,'xlabel'),'Extent');
-    nskip=ceil(max(tlext(:,4))/xlext(4));
-    xlabel(cellstr([repmat('        ',nskip,1);'Response']));
-    clear nskip xlext tlext
-end
-ylabel('Value')
-
-if ~exist('lstr','var') || isempty(lstr)
-    lstr=cell(1,length(prob));
-    for i=1:length(prob)
-        lstr(i)=cellstr(sprintf('%g%%',100*prob(i)));
-    end
-end
-
-hleg1=legend(ax1,lstr,'Location','EastOutside',...
-             'Orientation','vertical','Interpreter','none');
-
-end
Index: sm/trunk/src/m/qmu/plot_normplot.m
===================================================================
--- /issm/trunk/src/m/qmu/plot_normplot.m	(revision 4762)
+++ 	(revision )
@@ -1,148 +1,0 @@
-%
-%  plot a normal probability plot of the responses.
-%
-%  []=plot_normplot(dresp      ,params)
-%  []=plot_normplot(dresp,descr,params)
-%  []=plot_normplot(sampr,descr,params)
-%
-%  where the required input is:
-%    dresp         (structure array, responses)
-%      or
-%    dresp         (structure array, responses)
-%    descr         (cell array, list of response descriptions desired)
-%      or
-%    sampr         (double array, lists of response samples)
-%    descr         (cell array, list of response descriptions)
-%
-%  the required fields of dresp are:
-%    descriptor    (char, description)
-%    sample        (double vector, list of samples)
-%
-%  the optional input is:
-%    params        (string/numeric, parameter names and values)
-%
-%  where the optional parameters are:
-%    xmin          (numeric, minimum of x-axis)
-%    xmax          (numeric, maximum of x-axis)
-%
-%  for each response in the input array, this function plots
-%  a matlab normal probability plot of the list of samples
-%  and annotates it with the description.  the lists of samples
-%  need not all be the same length.
-%
-%  this data would typically be contained in the dakota tabular
-%  output file and read by dakota_out_parse.
-%
-%  "Copyright 2009, by the California Institute of Technology.
-%  ALL RIGHTS RESERVED. United States Government Sponsorship
-%  acknowledged. Any commercial use must be negotiated with
-%  the Office of Technology Transfer at the California Institute
-%  of Technology.  (J. Schiermeier, NTR 47078)
-%
-%  This software may be subject to U.S. export control laws.
-%  By accepting this  software, the user agrees to comply with
-%  all applicable U.S. export laws and regulations. User has the
-%  responsibility to obtain export licenses, or other export
-%  authority as may be required before exporting such information
-%  to foreign countries or providing access to foreign persons."
-%
-function []=plot_normplot(varargin)
-
-if ~nargin
-    help plot_normplot
-    return
-end
-
-%%  process input data and assemble into matrices as needed
-
-%  responses
-
-iarg=1;
-if isstruct(varargin{iarg})
-    dresp=varargin{iarg};
-    iarg=iarg+1;
-    
-%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
-    if iarg <= nargin && iscell(varargin{iarg})
-        dresp=struc_desc(dresp,varargin{iarg});
-        iarg=iarg+1;
-    end
-    
-    descr=cell (1,length(dresp));
-    lsamp=zeros(1,length(dresp));
-    for i=1:length(dresp)
-        lsamp(i)=length(dresp(i).sample);
-    end
-    sampr=zeros(max(lsamp),length(dresp));
-    sampr(:,:)=NaN;
-
-    for i=1:length(dresp)
-        descr(i)=cellstr(dresp(i).descriptor);
-        sampr(1:lsamp(i),i)=dresp(i).sample;
-    end
-else
-    sampr=varargin{iarg};
-    iarg=iarg+1;
-    
-    if     iarg <= nargin && iscell(varargin{iarg})
-        descr=varargin{iarg};
-        iarg=iarg+1;
-%     elseif iarg <= nargin && ischar(varargin{iarg})
-%         descr=cellstr(varargin{iarg});
-%         iarg=iarg+1;
-    else
-        descr=cell(1,size(sampr,2));
-    end
-end
-
-for i=1:length(descr)
-    if isempty(descr{i})
-        descr(i)={['resp_' num2str(i)]};
-    end
-end
-
-%  parameters
-
-while (iarg <= nargin-1)
-    if ischar(varargin{iarg})
-        eval([varargin{iarg} '=varargin{iarg+1};']);
-        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
-    else
-        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
-    end
-    iarg=iarg+2;
-end
-    
-%%  draw the plot
-
-%  draw normal probability plot
-
-figure
-normplot(sampr)
-ax1=gca;
-
-%  add the annotation
-
-xlim('auto')
-[xlims]=xlim;
-if exist('xmin','var')
-    xlims(1)=xmin;
-end
-if exist('xmax','var')
-    xlims(2)=xmax;
-end
-xlim(xlims)
-
-if (size(sampr,2) == 1)
-    tlabc=descr{1};
-else
-    tlabc='Responses';
-end
-title(['Normal Probability Plot of ' tlabc],'Interpreter','none');
-xlabel('Value'      ,'Interpreter','none');
-ylabel('Probability','Interpreter','none');
-
-hleg1=legend(ax1,descr,'Location','EastOutside',...
-             'Orientation','vertical','Interpreter','none');
-
-end
Index: sm/trunk/src/m/qmu/plot_prob_bars.m
===================================================================
--- /issm/trunk/src/m/qmu/plot_prob_bars.m	(revision 4762)
+++ 	(revision )
@@ -1,191 +1,0 @@
-%
-%  plot a stacked bar chart of the probabilities in the CDF.
-%
-%  []=plot_prob_bars(dresp      ,params)
-%  []=plot_prob_bars(dresp,descr,params)
-%
-%  where the required input is:
-%    dresp         (structure array, responses)
-%      or
-%    dresp         (structure array, responses)
-%    descr         (cell array, list of response descriptions desired)
-%
-%  the required fields of dresp are:
-%    descriptor    (char, description)
-%    cdf(:,4)      (double matrix, CDF table)
-%
-%  the optional input is:
-%    params        (string/numeric, parameter names and values)
-%
-%  where the optional parameters are:
-%    ymin          (numeric, minimum of y-axis)
-%    ymax          (numeric, maximum of y-axis)
-%    xtlrot        (numeric, rotation in degrees of x-tick labels)
-%    cmap          (char, 'stoplight' for 6-color stoplight colormap)
-%    lstr          (cell array, legend labels)
-%
-%  for each response in the input array, this function plots
-%  a stacked bar plot of the responses, where the bars are
-%  stacked by the probabilities corresponding to the given
-%  response levels in the CDF, and annotates it with the
-%  description.  the legend labels can be given or constructed
-%  from the response levels.
-%
-%  this data would typically be contained in the dakota output
-%  file and read by dakota_out_parse.
-%
-%  "Copyright 2009, by the California Institute of Technology.
-%  ALL RIGHTS RESERVED. United States Government Sponsorship
-%  acknowledged. Any commercial use must be negotiated with
-%  the Office of Technology Transfer at the California Institute
-%  of Technology.  (J. Schiermeier, NTR 47078)
-%
-%  This software may be subject to U.S. export control laws.
-%  By accepting this  software, the user agrees to comply with
-%  all applicable U.S. export laws and regulations. User has the
-%  responsibility to obtain export licenses, or other export
-%  authority as may be required before exporting such information
-%  to foreign countries or providing access to foreign persons."
-%
-function []=plot_prob_bars(varargin)
-
-if ~nargin
-    help plot_prob_bars
-    return
-end
-
-%%  assemble the data into a matrix and calculate the increments
-
-
-%%  process input data and assemble into matrices and increments
-
-%  responses
-
-iarg=1;
-if isstruct(varargin{iarg})
-    dresp=varargin{iarg};
-    iarg=iarg+1;
-    
-%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
-    if iarg <= nargin && iscell(varargin{iarg})
-        dresp=struc_desc(dresp,varargin{iarg});
-        iarg=iarg+1;
-    end
-    
-    descr=cell (1,length(dresp));
-    lcdfr=zeros(1,length(dresp));
-    for i=1:length(dresp)
-        lcdfr(i)=size(dresp(i).cdf,1);
-    end
-    cdfr=zeros(length(dresp),max(lcdfr));
-
-    for i=1:length(dresp)
-        descr(i)=cellstr(dresp(i).descriptor);
-        if ~isempty(dresp(i).cdf)
-            cdfr(i,1)=dresp(i).cdf(1,2);
-            for j=2:size(dresp(i).cdf,1)
-                if (dresp(i).cdf(j,2) > dresp(i).cdf(j-1,2))
-                    cdfr(i,j)=dresp(i).cdf(j,2)-dresp(i).cdf(j-1,2);
-                end
-            end
-        end
-    end
-else
-    error(['''' inputname(iarg) ''' is not a structure.']);
-end
-
-%  convert to percentage
-
-cdfr=cdfr*100.;
-
-%  parameters
-
-while (iarg <= nargin-1)
-    if ischar(varargin{iarg})
-        eval([varargin{iarg} '=varargin{iarg+1};']);
-        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
-    else
-        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
-    end
-    iarg=iarg+2;
-end
-
-%%  draw the stacked bar plot
-
-%  if there's only one row, Matlab 7.5 interprets it as a column,
-%  so add an extra row, then reduce xlim
-
-if length(dresp) == 1
-    cdfr=[cdfr; cdfr];
-end
-
-figure
-hl1=bar(cdfr,'stacked');
-if exist('cmap','var')
-    if strncmpi(cmap,'stop',4)
-%         set(hl1(1),'FaceColor','green')
-%         set(hl1(2),'FaceColor',[.7 1 0])
-%         set(hl1(3),'FaceColor','yellow')
-%         set(hl1(4),'FaceColor',[1 .7 0])
-%         set(hl1(5),'FaceColor',[1 .5 0])
-%         set(hl1(6),'FaceColor','red')
-        colormap([0 1 0;.7 1 0;1 1 0;1 .7 0;1 .5 0;1 0 0]);
-    else
-        colormap(cmap);
-    end
-end
-
-ax1=gca;
-if length(dresp) == 1
-    set(ax1,'xlim',[0.5 1.5])
-end
-
-% set(ax1,'ylim',[0 120])
-% ylim('auto')
-% [ylims]=ylim;
-[ylims]=[0 120];
-if exist('ymin','var')
-    ylims(1)=ymin;
-end
-if exist('ymax','var')
-    ylims(2)=ymax;
-end
-ylim(ylims)
-
-set(ax1,'xtick',1:length(descr))
-set(ax1,'xticklabel',descr)
-if exist('xtlrot','var')
-    htl=rotateticklabel(ax1,xtlrot);
-    tlext=zeros(length(htl),4);
-    for i=1:length(htl)
-        tlext(i,:)=get(htl(i),'Extent');
-    end
-end
-
-%  add the annotation
-
-title('Probabilities for Specified Response Levels (RIA)')
-xlabel('Response')
-if exist('xtlrot','var')
-    xlext=get(get(ax1,'xlabel'),'Extent');
-    nskip=ceil(max(tlext(:,4))/xlext(4));
-    xlabel(cellstr([repmat('        ',nskip,1);'Response']));
-    clear nskip xlext tlext
-end
-ylabel('Percent Below Level')
-
-if ~exist('lstr','var') || isempty(lstr)
-    lstr=cell(1,max(lcdfr));
-    for i=1:max(lcdfr)
-        lstr(i)=cellstr(sprintf('%g',...
-            dresp(find(lcdfr == max(lcdfr),1,'first')).cdf(i,1)));
-    end
-    if ~isempty(find(lcdfr < max(lcdfr)))
-        warning('Variable number of levels for responses.');
-    end
-end
-
-hleg1=legend(ax1,lstr,'Location','EastOutside',...
-             'Orientation','vertical','Interpreter','none');
-
-end
Index: sm/trunk/src/m/qmu/plot_rlev_bars.m
===================================================================
--- /issm/trunk/src/m/qmu/plot_rlev_bars.m	(revision 4762)
+++ 	(revision )
@@ -1,172 +1,0 @@
-%
-%  plot a stacked bar chart of the response levels in the cdf.
-%
-%  []=plot_rlev_bars(dresp      ,params)
-%  []=plot_rlev_bars(dresp,descr,params)
-%
-%  where the required input is:
-%    dresp         (structure array, responses)
-%      or
-%    dresp         (structure array, responses)
-%    descr         (cell array, list of response descriptions desired)
-%
-%  the required fields of dresp are:
-%    descriptor    (char, description)
-%    cdf(:,4)      (double matrix, CDF table)
-%
-%  the optional input is:
-%    params        (string/numeric, parameter names and values)
-%
-%  where the optional parameters are:
-%    ymin          (numeric, minimum of y-axis)
-%    ymax          (numeric, maximum of y-axis)
-%    xtlrot        (numeric, rotation in degrees of x-tick labels)
-%    lstr          (cell array, legend labels)
-%
-%  for each response in the input array, this function plots
-%  a stacked bar plot of the responses, where the bars are
-%  stacked by the response levels corresponding to the given
-%  probabilities in the CDF, and annotates it with the
-%  description.  the legend labels can be given or constructed
-%  from the probabilities.
-%
-%  this data would typically be contained in the dakota output
-%  file and read by dakota_out_parse.
-%
-%  "Copyright 2009, by the California Institute of Technology.
-%  ALL RIGHTS RESERVED. United States Government Sponsorship
-%  acknowledged. Any commercial use must be negotiated with
-%  the Office of Technology Transfer at the California Institute
-%  of Technology.  (J. Schiermeier, NTR 47078)
-%
-%  This software may be subject to U.S. export control laws.
-%  By accepting this  software, the user agrees to comply with
-%  all applicable U.S. export laws and regulations. User has the
-%  responsibility to obtain export licenses, or other export
-%  authority as may be required before exporting such information
-%  to foreign countries or providing access to foreign persons."
-%
-function []=plot_rlev_bars(varargin)
-
-if ~nargin
-    help plot_rlev_bars
-    return
-end
-
-%%  process input data and assemble into matrices and increments
-
-%  responses
-
-iarg=1;
-if isstruct(varargin{iarg})
-    dresp=varargin{iarg};
-    iarg=iarg+1;
-    
-%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
-    if iarg <= nargin && iscell(varargin{iarg})
-        dresp=struc_desc(dresp,varargin{iarg});
-        iarg=iarg+1;
-    end
-    
-    descr=cell (1,length(dresp));
-    lcdfr=zeros(1,length(dresp));
-    for i=1:length(dresp)
-        lcdfr(i)=size(dresp(i).cdf,1);
-    end
-    cdfr=zeros(length(dresp),max(lcdfr));
-
-    for i=1:length(dresp)
-        descr(i)=cellstr(dresp(i).descriptor);
-        if ~isempty(dresp(i).cdf)
-            cdfr(i,1)=dresp(i).cdf(1,1);
-            for j=2:size(dresp(i).cdf,1)
-                if (dresp(i).cdf(j,1) > dresp(i).cdf(j-1,1))
-                    cdfr(i,j)=dresp(i).cdf(j,1)-dresp(i).cdf(j-1,1);
-                end
-            end
-        end
-    end
-else
-    error(['''' inputname(iarg) ''' is not a structure.']);
-end
-
-%  parameters
-
-while (iarg <= nargin-1)
-    if ischar(varargin{iarg})
-        eval([varargin{iarg} '=varargin{iarg+1};']);
-        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
-    else
-        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
-    end
-    iarg=iarg+2;
-end
-
-%%  draw the stacked bar plot
-
-%  if there's only one row, Matlab 7.5 interprets it as a column,
-%  so add an extra row, then reduce xlim
-
-if length(dresp) == 1
-    cdfr=[cdfr; cdfr];
-end
-
-figure
-hl1=bar(cdfr,'stacked');
-%  set barseries properties for lowest value
-whitebg('white')
-set(hl1(1),'FaceColor','white')
-set(hl1(1),'Visible','off')
-
-ax1=gca;
-if length(dresp) == 1
-    set(ax1,'xlim',[0.5 1.5])
-end
-
-ylim('auto')
-[ylims]=ylim;
-if exist('ymin','var')
-    ylims(1)=ymin;
-end
-if exist('ymax','var')
-    ylims(2)=ymax;
-end
-ylim(ylims)
-
-set(ax1,'xtick',1:length(descr))
-set(ax1,'xticklabel',descr)
-if exist('xtlrot','var')
-    htl=rotateticklabel(ax1,xtlrot);
-    tlext=zeros(length(htl),4);
-    for i=1:length(htl)
-        tlext(i,:)=get(htl(i),'Extent');
-    end
-end
-
-%  add the annotation
-
-title('Response Levels for Specified Probabilities (PMA)')
-xlabel('Response');
-if exist('xtlrot','var')
-    xlext=get(get(ax1,'xlabel'),'Extent');
-    nskip=ceil(max(tlext(:,4))/xlext(4));
-    xlabel(cellstr([repmat('        ',nskip,1);'Response']));
-    clear nskip xlext tlext
-end
-ylabel('Response Level')
-
-if ~exist('lstr','var') || isempty(lstr)
-    lstr=cell(1,max(lcdfr));
-    for i=1:max(lcdfr)
-        lstr(i)=cellstr(sprintf('%g%%',...
-            100*dresp(find(lcdfr == max(lcdfr),1,'first')).cdf(i,2)));
-    end
-    if ~isempty(find(lcdfr < max(lcdfr),1))
-        warning('Variable number of probabilities for responses.');
-    end
-end
-
-hleg1=legend(ax1,lstr,'Location','EastOutside',...
-             'Orientation','vertical','Interpreter','none');
-
-end
Index: sm/trunk/src/m/qmu/plot_rlev_bars_ci.m
===================================================================
--- /issm/trunk/src/m/qmu/plot_rlev_bars_ci.m	(revision 4762)
+++ 	(revision )
@@ -1,263 +1,0 @@
-%
-%  plot a stacked bar chart of the response levels in the cdf
-%  for the sample and confidence intervals.
-%
-%  []=plot_rlev_bars_ci(dresp      ,params)
-%  []=plot_rlev_bars_ci(dresp,descr,params)
-%  []=plot_rlev_bars_ci(sampr,descr,params)
-%
-%  where the required input is:
-%    dresp         (structure array, responses)
-%      or
-%    dresp         (structure array, responses)
-%    descr         (cell array, list of response descriptions desired)
-%      or
-%    sampr         (double array, lists of response samples)
-%    descr         (cell array, list of response descriptions)
-%
-%  the required fields of dresp are:
-%    descriptor    (char, description)
-%    cdf(:,4)      (double matrix, CDF table)
-%
-%  and the optional fields of dresp are:
-%    mean          (double, mean of sample)
-%    stddev        (double, standard deviation of sample)
-%    meanci(2)     (double, confidence interval of mean)
-%    stddevci(2)   (double, confidence interval of standard deviation)
-%
-%  the optional input is:
-%    params        (string/numeric, parameter names and values)
-%
-%  where the optional parameters are:
-%    ymin          (numeric, minimum of y-axis)
-%    ymax          (numeric, maximum of y-axis)
-%    xtlrot        (numeric, rotation in degrees of x-tick labels)
-%    lstr          (cell array, legend labels)
-%
-%  for each response in the input array, this function plots
-%  a stacked bar plot of the responses, where the bars are
-%  stacked by the response levels corresponding to the given
-%  probabilities in the CDF, and annotates it with the
-%  description.  the response levels for the normal distribution
-%  and the confidence intervals are also plotted.  the legend
-%  labels can be given or constructed from the probabilities.
-%
-%  dresp data would typically be contained in the dakota tabular
-%  output file from a sampling analysis, read by dakota_out_parse.
-%
-%  "Copyright 2009, by the California Institute of Technology.
-%  ALL RIGHTS RESERVED. United States Government Sponsorship
-%  acknowledged. Any commercial use must be negotiated with
-%  the Office of Technology Transfer at the California Institute
-%  of Technology.  (J. Schiermeier, NTR 47078)
-%
-%  This software may be subject to U.S. export control laws.
-%  By accepting this  software, the user agrees to comply with
-%  all applicable U.S. export laws and regulations. User has the
-%  responsibility to obtain export licenses, or other export
-%  authority as may be required before exporting such information
-%  to foreign countries or providing access to foreign persons."
-%
-function []=plot_rlev_bars_ci(varargin)
-
-if ~nargin
-    help plot_rlev_bars_ci
-    return
-end
-
-%%  process input data and assemble into dresp as needed
-
-%  responses
-
-iarg=1;
-if isstruct(varargin{iarg})
-    dresp=varargin{iarg};
-    iarg=iarg+1;
-    
-%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
-    if iarg <= nargin && iscell(varargin{iarg})
-        dresp=struc_desc(dresp,varargin{iarg});
-        iarg=iarg+1;
-    end
-else
-    sampr=varargin{iarg};
-    iarg=iarg+1;
-    
-    if     iarg <= nargin && iscell(varargin{iarg})
-        descr=varargin{iarg};
-        iarg=iarg+1;
-%     elseif iarg <= nargin && ischar(varargin{iarg})
-%         descr=cellstr(varargin{iarg});
-%         iarg=iarg+1;
-    else
-        descr=cell(1:size(sampr,2));
-    end
-    
-    dresp=struct([]);
-    for i=1:size(sampr,2)
-        dresp(end+1).sample=sampr(:,i);
-        if ~isempty(descr)
-            dresp(i).descriptor=descr{i};
-        else
-            dresp(i).descriptor=['dresp_' num2str(i)];
-        end
-    end
-end
-
-%  parameters
-
-while (iarg <= nargin-1)
-    if ischar(varargin{iarg})
-        eval([varargin{iarg} '=varargin{iarg+1};']);
-        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
-    else
-        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
-    end
-    iarg=iarg+2;
-end
-
-%%  calculate any missing information (noting that dresp is local)
-
-for i=1:length(dresp)
-    if ~isfield(dresp(i),'mean') || isempty(dresp(i).mean) || ...
-       ~isfield(dresp(i),'stddev') || isempty(dresp(i).stddev) || ...
-       ~isfield(dresp(i),'meanci') || isempty(dresp(i).meanci) || ...
-       ~isfield(dresp(i),'stddevci') || isempty(dresp(i).stddevci)
-%  calculate 95% confidence intervals (same as dakota)
-        [dresp(i).mean,dresp(i).stddev,...
-         dresp(i).meanci,dresp(i).stddevci]=...
-            normfit(sampr(:,i),0.05);
-        display('Using calculated normal fits from sample data.')
-    end
-    
-    if ~isfield(dresp(i),'cdf') || isempty(dresp(i).cdf)
-%  use minus/plus integer standard deviations
-        sdvect=[-4 -3 -2 -1 0 1 2 3 4];
-        dresp(i).cdf(:,2)=normcdf(sdvect,0,1);
-        dresp(i).cdf(:,1)=norminv(dresp(i).cdf(:,2),...
-                                  dresp(i).mean,dresp(i).stddev);
-        display('Using integer standard deviations for percentages.')
-
-        if ~exist('lstr','var') || isempty(lstr)
-            lstr=cell(1,size(dresp(i).cdf,1));
-            for j=1:size(dresp(i).cdf,1)
-                if sdvect(j)
-                    lstr{j}=sprintf('mu %+d sigma',sdvect(j));
-                else
-                    lstr{j}='mu';
-                end
-            end
-        end
-    end
-end
-
-%%  assemble the data into a matrix and calculate the increments
-
-descr=cell (1,0);
-lcdfr=zeros(1,length(dresp));
-for i=1:length(dresp)
-    lcdfr(i)=size(dresp(i).cdf,1);
-end
-cdfr=zeros(0,max(lcdfr));
-
-%  fill in the cdf data
-
-for i=1:length(dresp)
-    if ~isempty(dresp(i).cdf)
-        descr(end+1)=cellstr([dresp(i).descriptor]);
-        cdfr(end+1,:)=dresp(i).cdf(:,1);
-        if isfield(dresp(i),'mean'  ) && ~isempty(dresp(i).mean  ) && ...
-           isfield(dresp(i),'stddev') && ~isempty(dresp(i).stddev)
-            descr(end+1)=cellstr([dresp(i).descriptor ' norm']);
-            cdfr(end+1,:)=norminv(dresp(i).cdf(:,2),dresp(i).mean,dresp(i).stddev);
-        end
-        if isfield(dresp(i),'meanci'  ) && ~isempty(dresp(i).meanci  ) && ...
-           isfield(dresp(i),'stddevci') && ~isempty(dresp(i).stddevci)
-            descr(end+1)=cellstr([dresp(i).descriptor ' norm-+']);
-            descr(end+1)=cellstr([dresp(i).descriptor ' norm--']);
-            descr(end+1)=cellstr([dresp(i).descriptor ' norm+-']);
-            descr(end+1)=cellstr([dresp(i).descriptor ' norm++']);
-            cdfr(end+1,:)=norminv(dresp(i).cdf(:,2),dresp(i).meanci(1),dresp(i).stddevci(2));
-            cdfr(end+1,:)=norminv(dresp(i).cdf(:,2),dresp(i).meanci(1),dresp(i).stddevci(1));
-            cdfr(end+1,:)=norminv(dresp(i).cdf(:,2),dresp(i).meanci(2),dresp(i).stddevci(1));
-            cdfr(end+1,:)=norminv(dresp(i).cdf(:,2),dresp(i).meanci(2),dresp(i).stddevci(2));
-        end
-    end
-end
-
-%  calculate the increments
-
-for i=1:size(cdfr,1)
-    for j=find(cdfr(i,:),1,'last'):-1:2
-        cdfr(i,j)=cdfr(i,j)-cdfr(i,j-1);
-    end
-end
-
-%%  draw the stacked bar plot
-
-%  if there's only one row, Matlab 7.5 interprets it as a column,
-%  so add an extra row, then reduce xlim
-
-if length(descr) == 1
-    cdfr=[cdfr; cdfr];
-end
-
-figure
-hl1=bar(cdfr,'stacked');
-%  set barseries properties for lowest value
-whitebg('white')
-set(hl1(1),'FaceColor','white')
-set(hl1(1),'Visible','off')
-
-ax1=gca;
-if length(descr) == 1
-    set(ax1,'xlim',[0.5 1.5])
-end
-
-ylim('auto')
-[ylims]=ylim;
-if exist('ymin','var')
-    ylims(1)=ymin;
-end
-if exist('ymax','var')
-    ylims(2)=ymax;
-end
-ylim(ylims)
-
-set(ax1,'xtick',1:length(descr))
-set(ax1,'xticklabel',descr)
-if exist('xtlrot','var')
-    htl=rotateticklabel(ax1,xtlrot);
-    tlext=zeros(length(htl),4);
-    for i=1:length(htl)
-        tlext(i,:)=get(htl(i),'Extent');
-    end
-end
-
-%  add the annotation
-
-title('Response Levels for Specified Probabilities (PMA)');
-xlabel('Response');
-if exist('xtlrot','var')
-    xlext=get(get(ax1,'xlabel'),'Extent');
-    nskip=ceil(max(tlext(:,4))/xlext(4));
-    xlabel(cellstr([repmat('        ',nskip,1);'Response']));
-    clear nskip xlext tlext
-end
-ylabel('Response Level');
-
-if ~exist('lstr','var') || isempty(lstr)
-    lstr=cell(1,max(lcdfr));
-    for i=1:max(lcdfr)
-        lstr(i)=cellstr(sprintf('%g%%',...
-            100*dresp(find(lcdfr == max(lcdfr),1,'first')).cdf(i,2)));
-    end
-    if ~isempty(find(lcdfr < max(lcdfr),1,'first'))
-        warning('Variable number of probabilities for responses.');
-    end
-end
-
-hleg1=legend(ax1,lstr,'Location','EastOutside',...
-             'Orientation','vertical','Interpreter','none');
-
-end
Index: sm/trunk/src/m/qmu/plot_rvsv_line.m
===================================================================
--- /issm/trunk/src/m/qmu/plot_rvsv_line.m	(revision 4762)
+++ 	(revision )
@@ -1,257 +1,0 @@
-%
-%  plot line plots of responses vs. variables.
-%
-%  []=plot_rvsv_line(dvar       ,dresp      ,params)
-%  []=plot_rvsv_line(dvar ,descv,dresp,descr,params)
-%  []=plot_rvsv_line(sampv,descv,sampr,descr,params)
-%
-%  where the required input is:
-%    dvar          (structure array, variables)
-%      or
-%    dvar          (structure array, variables)
-%    descv         (cell array, list of variable descriptions desired)
-%      or
-%    sampv         (double array, lists of variable samples)
-%    descv         (cell array, list of variable descriptions)
-%
-%    dresp         (structure array, responses)
-%      or
-%    dresp         (structure array, responses)
-%    descr         (cell array, list of response descriptions desired)
-%      or
-%    sampr         (double array, lists of response samples)
-%    descr         (cell array, list of response descriptions)
-%
-%  the required fields of dvar and dresp are:
-%    descriptor    (char, description)
-%    sample        (double vector, list of samples)
-%
-%  the optional input is:
-%    params        (string/numeric, parameter names and values)
-%
-%  where the optional parameters are:
-%    nplotr        (numeric, number of plot rows)
-%    nplotc        (numeric, number of plot columns)
-%    ymin          (numeric, minimum of y-axis)
-%    ymax          (numeric, maximum of y-axis)
-%    yscat         (char, 'off' to turn off y-axis scattergram)
-%
-%  for each variable/response combination in the input array, this
-%  function plots a line plot.  all of the variables and responses
-%  are plotted on the same axes, if nplotr and nplotc are not
-%  specified, so some scaling might otherwise be desired.
-%
-%  dvar and dresp data would typically be contained in the dakota
-%  tabular output file from a sampling or parametric analysis, and
-%  read by dakota_out_parse.
-%
-%  "Copyright 2009, by the California Institute of Technology.
-%  ALL RIGHTS RESERVED. United States Government Sponsorship
-%  acknowledged. Any commercial use must be negotiated with
-%  the Office of Technology Transfer at the California Institute
-%  of Technology.  (J. Schiermeier, NTR 47078)
-%
-%  This software may be subject to U.S. export control laws.
-%  By accepting this  software, the user agrees to comply with
-%  all applicable U.S. export laws and regulations. User has the
-%  responsibility to obtain export licenses, or other export
-%  authority as may be required before exporting such information
-%  to foreign countries or providing access to foreign persons."
-%
-function []=plot_rvsv_line(varargin)
-
-if ~nargin
-    help plot_rvsv_line
-    return
-end
-
-%%  process input data and assemble into matrices as needed
-
-%  variables
-
-iarg=1;
-if isstruct(varargin{iarg})
-    dvar=varargin{iarg};
-    iarg=iarg+1;
-    
-%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
-    if iarg <= nargin && iscell(varargin{iarg})
-        dvar=struc_desc(dvar,varargin{iarg});
-        iarg=iarg+1;
-    end
-    
-    descv=cell (1,length(dvar));
-    lsamp=zeros(1,length(dvar));
-    for i=1:length(dvar)
-        lsamp(i)=length(dvar(i).sample);
-    end
-    sampv=zeros(max(lsamp),length(dvar));
-    sampv(:,:)=NaN;
-
-    for i=1:length(dvar)
-        descv(i)=cellstr(dvar(i).descriptor);
-        sampv(1:lsamp(i),i)=dvar(i).sample;
-    end
-else
-    sampv=varargin{iarg};
-    iarg=iarg+1;
-    
-    if     iarg <= nargin && iscell(varargin{iarg})
-        descv=varargin{iarg};
-        iarg=iarg+1;
-%     elseif iarg <= nargin && ischar(varargin{iarg})
-%         descv=cellstr(varargin{iarg});
-%         iarg=iarg+1;
-    else
-        descv=cell(1,size(sampv,2));
-    end
-end
-
-for i=1:length(descv)
-    if isempty(descv{i})
-        descv(i)={['var_' i]};
-    end
-end
-
-%  responses
-
-if isstruct(varargin{iarg})
-    dresp=varargin{iarg};
-    iarg=iarg+1;
-    
-%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
-    if iarg <= nargin && iscell(varargin{iarg})
-        dresp=struc_desc(dresp,varargin{iarg});
-        iarg=iarg+1;
-    end
-    
-    descr=cell (1,length(dresp));
-    lsamp=zeros(1,length(dresp));
-    for i=1:length(dresp)
-        lsamp(i)=length(dresp(i).sample);
-    end
-    sampr=zeros(max(lsamp),length(dresp));
-    sampr(:,:)=NaN;
-
-    for i=1:length(dresp)
-        descr(i)=cellstr(dresp(i).descriptor);
-        sampr(1:lsamp(i),i)=dresp(i).sample;
-    end
-else
-    sampr=varargin{iarg};
-    iarg=iarg+1;
-    
-    if     iarg <= nargin && iscell(varargin{iarg})
-        descr=varargin{iarg};
-        iarg=iarg+1;
-%     elseif iarg <= nargin && ischar(varargin{iarg})
-%         descr=cellstr(varargin{iarg});
-%         iarg=iarg+1;
-    else
-        descr=cell(1,size(sampr,2));
-    end
-end
-
-for i=1:length(descr)
-    if isempty(descr{i})
-        descr(i)={['resp_' num2str(i)]};
-    end
-end
-
-%  parameters
-
-while (iarg <= nargin-1)
-    if ischar(varargin{iarg})
-        eval([varargin{iarg} '=varargin{iarg+1};']);
-        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
-    else
-        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
-    end
-    iarg=iarg+2;
-end
-    
-if     ~exist('nplotr','var') && ~exist('nplotc','var')
-    nplotr=1;
-    nplotc=1;
-elseif ~exist('nplotr','var')
-    nplotr=ceil(size(sampr,2)*size(sampv,2)/nplotc);
-elseif ~exist('nplotc','var')
-    nplotc=ceil(size(sampr,2)*size(sampv,2)/nplotr);
-end
-
-%%  filter, sort, and plot the data
-
-%  while it would be preferable for the outer loop to be responses,
-%  it is more efficient for the outer loop to be variables
-
-figure
-haxes=[];
-hplot=[];
-cdesc={};
-hscat=[];
-
-iplot=0;
-
-for ivar=1:size(sampv,2)
-    [vval,indxv,indxvi]=unique(sampv(:,ivar),'first');
-    indxv2=setdiff(1:size(sampv,1),indxv);
-
-    for iresp=1:size(sampr,2)
-
-%  initialize the subplot
-
-        if (ivar*iresp == 1) || ...
-           (nplotr*nplotc > 1)
-            iplot=iplot+1;
-            haxes(end+1)=subplot(nplotr,nplotc,iplot);
-            hold all
-        end
-
-        hplot(end+1)=plot   (sampv(indxv ,ivar),sampr(indxv ,iresp),'-x');
-        cdesc(end+1)={[descr{iresp} ' wrt ' descv{ivar}]};
-        if ~exist('yscat','var') || ~strcmpi(yscat,'off')
-            hscat(end+1)=scatter(sampv(indxv2,ivar),sampr(indxv2,iresp),'+k');
-%  see "controlling legends" in Matlab on-line docs
-%         cdesc(end+1)={['constant ' descv{ivar}]};
-            set(get(get(hscat(end),'Annotation'),'LegendInformation'),...
-                'IconDisplayStyle','off'); % Exclude line from legend
-        end
-        
-%  add the annotation
-
-        if (ivar*iresp == size(sampv,2)*size(sampr,2)) || ...
-           (nplotr*nplotc > 1)
-            hold off
-
-            ylim('auto')
-            [ylims]=ylim;
-            if exist('ymin','var')
-                ylims(1)=ymin;
-            end
-            if exist('ymax','var')
-                ylims(2)=ymax;
-            end
-            ylim(ylims)
-
-            if (size(sampv,2) == 1) || (nplotr*nplotc > 1)
-                xlabc=descv{ivar};
-            else
-                xlabc='Variables';
-            end
-            if (size(sampr,2) == 1) || (nplotr*nplotc > 1)
-                ylabc=descr{iresp};
-            else
-                ylabc='Responses';
-            end
-            title([ylabc ' vs. ' xlabc],'Interpreter','none');
-            xlabel(xlabc,'Interpreter','none');
-            ylabel(ylabc,'Interpreter','none');
-
-            if (nplotr*nplotc == 1) && (size(sampv,2)*size(sampr,2) > 1)
-                legend(cdesc,'Location','EastOutside','Interpreter','none');
-            end
-        end
-    end
-end
-
-end
Index: sm/trunk/src/m/qmu/plot_rvsv_scat3.m
===================================================================
--- /issm/trunk/src/m/qmu/plot_rvsv_scat3.m	(revision 4762)
+++ 	(revision )
@@ -1,273 +1,0 @@
-%
-%  plot 3-d scatter plots of variables vs. responses.
-%
-%  []=plot_rvsv_scat3(dvar       ,dresp      ,params)
-%  []=plot_rvsv_scat3(dvar ,descv,dresp,descr,params)
-%  []=plot_rvsv_scat3(sampv,descv,sampr,descr,params)
-%
-%  where the required input is:
-%    dvar          (structure array, variables)
-%      or
-%    dvar          (structure array, variables)
-%    descv         (cell array, list of variable descriptions desired)
-%      or
-%    sampv         (double array, lists of variable samples)
-%    descv         (cell array, list of variable descriptions)
-%
-%    dresp         (structure array, responses)
-%      or
-%    dresp         (structure array, responses)
-%    descr         (cell array, list of response descriptions desired)
-%      or
-%    sampr         (double array, lists of response samples)
-%    descr         (cell array, list of response descriptions)
-%
-%  the required fields of dvar and dresp are:
-%    descriptor    (char, description)
-%    sample        (double vector, list of samples)
-%
-%  the optional input is:
-%    params        (string/numeric, parameter names and values)
-%
-%  where the optional parameters are:
-%    nplotr        (numeric, number of plot rows)
-%    nplotc        (numeric, number of plot columns)
-%    ymin          (numeric, minimum of y-axis)
-%    ymax          (numeric, maximum of y-axis)
-%    zmin          (numeric, minimum of z-axis)
-%    zmax          (numeric, maximum of z-axis)
-%    cmin          (numeric, minimum of colorbar)
-%    cmax          (numeric, maximum of colorbar)
-%    smark         (numeric, size of markers)
-%
-%  for each response in the input array, this function plots a 3-d
-%  scatter plot.  there should be no more than three variables.
-%  each response will be in a separate scatter plot; hence the
-%  need for nplotr and nplotc.
-%
-%  dvar and dresp data would typically be contained in the dakota
-%  tabular output file from a sampling or parametric analysis, and
-%  read by dakota_out_parse.
-%
-%  "Copyright 2009, by the California Institute of Technology.
-%  ALL RIGHTS RESERVED. United States Government Sponsorship
-%  acknowledged. Any commercial use must be negotiated with
-%  the Office of Technology Transfer at the California Institute
-%  of Technology.  (J. Schiermeier, NTR 47078)
-%
-%  This software may be subject to U.S. export control laws.
-%  By accepting this  software, the user agrees to comply with
-%  all applicable U.S. export laws and regulations. User has the
-%  responsibility to obtain export licenses, or other export
-%  authority as may be required before exporting such information
-%  to foreign countries or providing access to foreign persons."
-%
-function []=plot_rvsv_scat3(varargin)
-
-if ~nargin
-    help plot_rvsv_scat3
-    return
-end
-
-%%  process input data and assemble into matrices as needed
-
-iarg=1;
-
-%  variables
-
-if isstruct(varargin{iarg})
-    dvar=varargin{iarg};
-    iarg=iarg+1;
-    
-%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
-    if iarg <= nargin && iscell(varargin{iarg})
-        dvar=struc_desc(dvar,varargin{iarg});
-        iarg=iarg+1;
-    end
-    
-    descv=cell (1,length(dvar));
-    lsamp=zeros(1,length(dvar));
-    for i=1:length(dvar)
-        lsamp(i)=length(dvar(i).sample);
-    end
-    sampv=zeros(max(lsamp),length(dvar));
-    sampv(:,:)=NaN;
-
-    for i=1:length(dvar)
-        descv(i)=cellstr(dvar(i).descriptor);
-        sampv(1:lsamp(i),i)=dvar(i).sample;
-    end
-else
-    sampv=varargin{iarg};
-    iarg=iarg+1;
-    
-    if     iarg <= nargin && iscell(varargin{iarg})
-        descv=varargin{iarg};
-        iarg=iarg+1;
-%     elseif iarg <= nargin && ischar(varargin{iarg})
-%         descv=cellstr(varargin{iarg});
-%         iarg=iarg+1;
-    else
-        descv=cell(1,size(sampv,2));
-    end
-end
-
-for i=1:length(descv)
-    if isempty(descv{i})
-        descv(i)={['var_' i]};
-    end
-end
-
-if (size(sampv,2) > 3)
-    error('No more than three variables required for 3-d scatter plot.');
-end
-
-%  responses
-
-if isstruct(varargin{iarg})
-    dresp=varargin{iarg};
-    iarg=iarg+1;
-    
-%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
-    if iarg <= nargin && iscell(varargin{iarg})
-        dresp=struc_desc(dresp,varargin{iarg});
-        iarg=iarg+1;
-    end
-    
-    descr=cell (1,length(dresp));
-    lsamp=zeros(1,length(dresp));
-    for i=1:length(dresp)
-        lsamp(i)=length(dresp(i).sample);
-    end
-    sampr=zeros(max(lsamp),length(dresp));
-    sampr(:,:)=NaN;
-
-    for i=1:length(dresp)
-        descr(i)=cellstr(dresp(i).descriptor);
-        sampr(1:lsamp(i),i)=dresp(i).sample;
-    end
-else
-    sampr=varargin{iarg};
-    iarg=iarg+1;
-    
-    if     iarg <= nargin && iscell(varargin{iarg})
-        descr=varargin{iarg};
-        iarg=iarg+1;
-%     elseif iarg <= nargin && ischar(varargin{iarg})
-%         descr=cellstr(varargin{iarg});
-%         iarg=iarg+1;
-    else
-        descr=cell(1,size(sampr,2));
-    end
-end
-
-for i=1:length(descr)
-    if isempty(descr{i})
-        descr(i)={['resp_' num2str(i)]};
-    end
-end
-
-%  parameters
-
-while (iarg <= nargin-1)
-    if ischar(varargin{iarg})
-        eval([varargin{iarg} '=varargin{iarg+1};']);
-        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
-    else
-        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
-    end
-    iarg=iarg+2;
-end
-    
-if     ~exist('nplotr','var') && ~exist('nplotc','var')
-    nplotr=ceil(sqrt(size(sampr,2)));
-    nplotc=ceil(size(sampr,2)/nplotr);
-elseif ~exist('nplotr','var')
-    nplotr=ceil(size(sampr,2)/nplotc);
-elseif ~exist('nplotc','var')
-    nplotc=ceil(size(sampr,2)/nplotr);
-end
-
-if ~exist('smark','var')
-    smark=100;
-end
-
-%%  filter, sort, and plot the data
-
-figure
-haxes =[];
-hscat3=[];
-
-for iresp=1:size(sampr,2)
-    
-%  initialize the subplot
-
-    haxes(end+1)=subplot(nplotr,nplotc,iresp);
-    switch size(sampv,2)
-        case 1
-            hscat3(end+1)=scatter (sampv(:,1),sampr(:,iresp),...
-                                   smark,sampr(:,iresp),'filled');
-        case 2
-            hscat3(end+1)=scatter3(sampv(:,1),sampv(:,2),sampr(:,iresp),...
-                                   smark,sampr(:,iresp),'filled');
-        case 3
-            hscat3(end+1)=scatter3(sampv(:,1),sampv(:,2),sampv(:,3),...
-                                   smark,sampr(:,iresp),'filled');
-    end
-
-    ylim('auto')
-    [ylims]=ylim;
-    if exist('ymin','var')
-        ylims(1)=ymin;
-    end
-    if exist('ymax','var')
-        ylims(2)=ymax;
-    end
-    ylim(ylims)
-
-    zlim('auto')
-    [zlims]=zlim;
-    if exist('zmin','var')
-        zlims(1)=zmin;
-    end
-    if exist('zmax','var')
-        zlims(2)=zmax;
-    end
-    zlim(zlims)
-
-%  add the annotation
-
-    switch size(sampv,2)
-        case 1
-            title([descr{iresp} ' wrt ' descv{1}],...
-                  'Interpreter','none');
-            xlabel(descv{1},'Interpreter','none');
-            ylabel(descr{iresp},'Interpreter','none');
-        case 2
-            title([descr{iresp} ' wrt ' descv{1} ' and ' descv{2}],...
-                  'Interpreter','none');
-            xlabel(descv{1},'Interpreter','none');
-            ylabel(descv{2},'Interpreter','none');
-            zlabel(descr{iresp},'Interpreter','none');
-        case 3
-            title([descr{iresp} ' wrt ' descv{1} ' and ' descv{2} ' and ' descv{3}],...
-                  'Interpreter','none');
-            xlabel(descv{1},'Interpreter','none');
-            ylabel(descv{2},'Interpreter','none');
-            zlabel(descv{3},'Interpreter','none');
-    end
-
-    caxis('auto')
-    [cmini,cmaxi]=caxis;
-    if exist('cmin','var')
-        cmini=cmin;
-    end
-    if exist('cmax','var')
-        cmaxi=cmax;
-    end
-    caxis([cmini cmaxi])
-
-    colorbar
-end
-
-end
Index: sm/trunk/src/m/qmu/plot_rvsv_surf.m
===================================================================
--- /issm/trunk/src/m/qmu/plot_rvsv_surf.m	(revision 4762)
+++ 	(revision )
@@ -1,240 +1,0 @@
-%
-%  plot surface plots of variables vs. responses.
-%
-%  []=plot_rvsv_surf(dvar       ,dresp      ,params)
-%  []=plot_rvsv_surf(dvar ,descv,dresp,descr,params)
-%  []=plot_rvsv_surf(sampv,descv,sampr,descr,params)
-%
-%  where the required input is:
-%    dvar          (structure array, variables)
-%      or
-%    dvar          (structure array, variables)
-%    descv         (cell array, list of variable descriptions desired)
-%      or
-%    sampv         (double array, lists of variable samples)
-%    descv         (cell array, list of variable descriptions)
-%
-%    dresp         (structure array, responses)
-%      or
-%    dresp         (structure array, responses)
-%    descr         (cell array, list of response descriptions desired)
-%      or
-%    sampr         (double array, lists of response samples)
-%    descr         (cell array, list of response descriptions)
-%
-%  the required fields of dvar and dresp are:
-%    descriptor    (char, description)
-%    sample        (double vector, list of samples)
-%
-%  the optional input is:
-%    params        (string/numeric, parameter names and values)
-%
-%  where the optional parameters are:
-%    nplotr        (numeric, number of plot rows)
-%    nplotc        (numeric, number of plot columns)
-%    zmin          (numeric, minimum of z-axis)
-%    zmax          (numeric, maximum of z-axis)
-%    cmin          (numeric, minimum of colorbar)
-%    cmax          (numeric, maximum of colorbar)
-%
-%  for each response in the input array, this function plots a
-%  surface plot.  there should be two and only two variables.
-%  each response will be in a separate surface plot; hence the
-%  need for nplotr and nplotc.
-%
-%  dvar and dresp data would typically be contained in the dakota
-%  tabular output file from a sampling or parametric analysis, and
-%  read by dakota_out_parse.
-%
-%  "Copyright 2009, by the California Institute of Technology.
-%  ALL RIGHTS RESERVED. United States Government Sponsorship
-%  acknowledged. Any commercial use must be negotiated with
-%  the Office of Technology Transfer at the California Institute
-%  of Technology.  (J. Schiermeier, NTR 47078)
-%
-%  This software may be subject to U.S. export control laws.
-%  By accepting this  software, the user agrees to comply with
-%  all applicable U.S. export laws and regulations. User has the
-%  responsibility to obtain export licenses, or other export
-%  authority as may be required before exporting such information
-%  to foreign countries or providing access to foreign persons."
-%
-function []=plot_rvsv_surf(varargin)
-
-if ~nargin
-    help plot_rvsv_surf
-    return
-end
-
-%%  process input data and assemble into matrices as needed
-
-iarg=1;
-
-%  variables
-
-if isstruct(varargin{iarg})
-    dvar=varargin{iarg};
-    iarg=iarg+1;
-    
-%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
-    if iarg <= nargin && iscell(varargin{iarg})
-        dvar=struc_desc(dvar,varargin{iarg});
-        iarg=iarg+1;
-    end
-    
-    descv=cell (1,length(dvar));
-    lsamp=zeros(1,length(dvar));
-    for i=1:length(dvar)
-        lsamp(i)=length(dvar(i).sample);
-    end
-    sampv=zeros(max(lsamp),length(dvar));
-    sampv(:,:)=NaN;
-
-    for i=1:length(dvar)
-        descv(i)=cellstr(dvar(i).descriptor);
-        sampv(1:lsamp(i),i)=dvar(i).sample;
-    end
-else
-    sampv=varargin{iarg};
-    iarg=iarg+1;
-    
-    if     iarg <= nargin && iscell(varargin{iarg})
-        descv=varargin{iarg};
-        iarg=iarg+1;
-%     elseif iarg <= nargin && ischar(varargin{iarg})
-%         descv=cellstr(varargin{iarg});
-%         iarg=iarg+1;
-    else
-        descv=cell(1,size(sampv,2));
-    end
-end
-
-for i=1:length(descv)
-    if isempty(descv{i})
-        descv(i)={['var_' i]};
-    end
-end
-
-if (size(sampv,2) ~= 2)
-    error('Two and only two variables required for surface plot.');
-end
-
-%  responses
-
-if isstruct(varargin{iarg})
-    dresp=varargin{iarg};
-    iarg=iarg+1;
-    
-%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
-    if iarg <= nargin && iscell(varargin{iarg})
-        dresp=struc_desc(dresp,varargin{iarg});
-        iarg=iarg+1;
-    end
-    
-    descr=cell (1,length(dresp));
-    lsamp=zeros(1,length(dresp));
-    for i=1:length(dresp)
-        lsamp(i)=length(dresp(i).sample);
-    end
-    sampr=zeros(max(lsamp),length(dresp));
-    sampr(:,:)=NaN;
-
-    for i=1:length(dresp)
-        descr(i)=cellstr(dresp(i).descriptor);
-        sampr(1:lsamp(i),i)=dresp(i).sample;
-    end
-else
-    sampr=varargin{iarg};
-    iarg=iarg+1;
-    
-    if     iarg <= nargin && iscell(varargin{iarg})
-        descr=varargin{iarg};
-        iarg=iarg+1;
-%     elseif iarg <= nargin && ischar(varargin{iarg})
-%         descr=cellstr(varargin{iarg});
-%         iarg=iarg+1;
-    else
-        descr=cell(1,size(sampr,2));
-    end
-end
-
-for i=1:length(descr)
-    if isempty(descr{i})
-        descr(i)={['resp_' num2str(i)]};
-    end
-end
-
-%  parameters
-
-while (iarg <= nargin-1)
-    if ischar(varargin{iarg})
-        eval([varargin{iarg} '=varargin{iarg+1};']);
-        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
-    else
-        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
-    end
-    iarg=iarg+2;
-end
-    
-if     ~exist('nplotr','var') && ~exist('nplotc','var')
-    nplotr=ceil(sqrt(size(sampr,2)));
-    nplotc=ceil(size(sampr,2)/nplotr);
-elseif ~exist('nplotr','var')
-    nplotr=ceil(size(sampr,2)/nplotc);
-elseif ~exist('nplotc','var')
-    nplotc=ceil(size(sampr,2)/nplotr);
-end
-
-%%  filter, sort, and plot the data
-
-figure
-haxes=[];
-hsurf=[];
-
-[x,ix,ixi]=unique(sampv(:,1),'first');
-[y,iy,iyi]=unique(sampv(:,2),'first');
-
-for iresp=1:size(sampr,2)
-    z=zeros(length(x),length(y));
-    for i=1:size(sampr,1)
-        z(ixi(i),iyi(i))=sampr(i,iresp);
-    end
-    
-%  initialize the subplot
-
-    haxes(iresp)=subplot(nplotr,nplotc,iresp);
-%     hsurf(iresp)=surfc(x,y,z);
-    surfc(x,y,z);
-
-    zlim('auto')
-    [zlims]=zlim;
-    if exist('zmin','var')
-        zlims(1)=zmin;
-    end
-    if exist('zmax','var')
-        zlims(2)=zmax;
-    end
-    zlim(zlims)
-
-%  add the annotation
-
-    title([descr{iresp} ' wrt ' descv{1} ' and ' descv{2}],...
-          'Interpreter','none');
-    xlabel(descv{1},'Interpreter','none');
-    ylabel(descv{2},'Interpreter','none');
-    zlabel(descr{iresp},'Interpreter','none');
-
-    caxis('auto')
-    [cmini,cmaxi]=caxis;
-    if exist('cmin','var')
-        cmini=cmin;
-    end
-    if exist('cmax','var')
-        cmaxi=cmax;
-    end
-    caxis([cmini cmaxi])
-
-    colorbar
-end
-
-end
Index: sm/trunk/src/m/qmu/plot_sampdist_bars.m
===================================================================
--- /issm/trunk/src/m/qmu/plot_sampdist_bars.m	(revision 4762)
+++ 	(revision )
@@ -1,205 +1,0 @@
-%
-%  plot a stacked bar chart of the sample distributions.
-%
-%  []=plot_sampdist_bars(dresp      ,params)
-%  []=plot_sampdist_bars(dresp,descr,params)
-%  []=plot_sampdist_bars(sampr,descr,params)
-%
-%  where the required input is:
-%    dresp         (structure array, responses)
-%      or
-%    dresp         (structure array, responses)
-%    descr         (cell array, list of response descriptions desired)
-%      or
-%    sampr         (double array, lists of response samples)
-%    descr         (cell array, list of response descriptions)
-%
-%  the required fields of dresp are:
-%    descriptor    (char, description)
-%    sample        (double vector, list of samples)
-%
-%  and the optional fields of dresp are:
-%    min           (double, minimum of sample)
-%    quart1        (double, first quartile of sample)
-%    median        (double, median of sample)
-%    quart3        (double, third quartile of sample)
-%    max           (double, maximum of sample)
-%
-%  the optional input is:
-%    params        (string/numeric, parameter names and values)
-%
-%  where the optional parameters are:
-%    ymin          (numeric, minimum of y-axis)
-%    ymax          (numeric, maximum of y-axis)
-%    xtlrot        (numeric, rotation in degrees of x-tick labels)
-%    lstr          (cell array, legend labels)
-%
-%  for each response in the input array, this function plots
-%  a stacked bar plot of the list of samples, where the bars
-%  are stacked by the four quartiles, and annotates it with
-%  the description.  the quartiles will be calculated from the
-%  samples if they do not already exist.
-%
-%  this data would typically be contained in the dakota tabular
-%  output file and read by dakota_out_parse.
-%
-%  "Copyright 2009, by the California Institute of Technology.
-%  ALL RIGHTS RESERVED. United States Government Sponsorship
-%  acknowledged. Any commercial use must be negotiated with
-%  the Office of Technology Transfer at the California Institute
-%  of Technology.  (J. Schiermeier, NTR 47078)
-%
-%  This software may be subject to U.S. export control laws.
-%  By accepting this  software, the user agrees to comply with
-%  all applicable U.S. export laws and regulations. User has the
-%  responsibility to obtain export licenses, or other export
-%  authority as may be required before exporting such information
-%  to foreign countries or providing access to foreign persons."
-%
-function []=plot_sampdist_bars(varargin)
-
-if ~nargin
-    help plot_sampdist_bars
-    return
-end
-
-%%  process input data and assemble into dresp as needed
-
-%  responses
-
-iarg=1;
-if isstruct(varargin{iarg})
-    dresp=varargin{iarg};
-    iarg=iarg+1;
-    
-%     if iarg <= nargin && (iscell(varargin{iarg}) || ischar(varargin{iarg}))
-    if iarg <= nargin && iscell(varargin{iarg})
-        dresp=struc_desc(dresp,varargin{iarg});
-        iarg=iarg+1;
-    end
-else
-    sampr=varargin{iarg};
-    iarg=iarg+1;
-    
-    if     iarg <= nargin && iscell(varargin{iarg})
-        descr=varargin{iarg};
-        iarg=iarg+1;
-%     elseif iarg <= nargin && ischar(varargin{iarg})
-%         descr=cellstr(varargin{iarg});
-%         iarg=iarg+1;
-    else
-        descr=cell(1:size(sampr,2));
-    end
-    
-    dresp=struct([]);
-    for i=1:size(sampr,2)
-        dresp(end+1).sample=sampr(:,i);
-        if ~isempty(descr)
-            dresp(i).descriptor=descr{i};
-        else
-            dresp(i).descriptor=['dresp_' num2str(i)];
-        end
-    end
-end
-
-%  parameters
-
-while (iarg <= nargin-1)
-    if ischar(varargin{iarg})
-        eval([varargin{iarg} '=varargin{iarg+1};']);
-        disp([varargin{iarg} '=' any2str(varargin{iarg+1}) ';']);
-    else
-        error(['''' any2str(varargin{iarg}) ''' is not a parameter name.']);
-    end
-    iarg=iarg+2;
-end
-
-%%  calculate any missing information (noting that dresp is local)
-
-if ~isfield(dresp,'min')    || ~isfield(dresp,'quart1') || ...
-   ~isfield(dresp,'median') || ~isfield(dresp,'quart3') || ...
-   ~isfield(dresp,'max')
-    for i=1:length(dresp)
-        dresp(i).min   =min    (dresp(i).sample);
-        dresp(i).quart1=prctile(dresp(i).sample,25);
-        dresp(i).median=median (dresp(i).sample);
-        dresp(i).quart3=prctile(dresp(i).sample,75);
-        dresp(i).max   =max    (dresp(i).sample);
-    end
-end
-
-%%  assemble the data into a matrix and calculate the increments
-
-descr=cell (1,length(dresp));
-data =zeros(length(dresp),5);
-
-for i=1:length(dresp)
-    descr(i)=cellstr(dresp(i).descriptor);
-    data(i,1)=dresp(i).min;
-    data(i,2)=dresp(i).quart1-dresp(i).min;
-    data(i,3)=dresp(i).median-dresp(i).quart1;
-    data(i,4)=dresp(i).quart3-dresp(i).median;
-    data(i,5)=dresp(i).max   -dresp(i).quart3;
-end
-
-%%  draw the stacked bar plot
-
-%  if there's only one row, Matlab 7.5 interprets it as a column,
-%  so add an extra row, then reduce xlim
-
-if length(dresp) == 1
-    data=[data; data];
-end
-
-figure
-hl1=bar(data,'stacked');
-%  set barseries properties for lowest value
-whitebg('white')
-set(hl1(1),'FaceColor','white')
-set(hl1(1),'Visible','off')
-
-ax1=gca;
-if length(dresp) == 1
-    set(ax1,'xlim',[0.5 1.5])
-end
-
-ylim('auto')
-[ylims]=ylim;
-if exist('ymin','var')
-    ylims(1)=ymin;
-end
-if exist('ymax','var')
-    ylims(2)=ymax;
-end
-ylim(ylims)
-
-set(ax1,'xtick',1:length(descr))
-set(ax1,'xticklabel',descr)
-if exist('xtlrot','var')
-    htl=rotateticklabel(ax1,xtlrot);
-    tlext=zeros(length(htl),4);
-    for i=1:length(htl)
-        tlext(i,:)=get(htl(i),'Extent');
-    end
-end
-
-%  add the annotation
-
-title('Sample Distributions of Responses')
-xlabel('Response')
-if exist('xtlrot','var')
-    xlext=get(get(ax1,'xlabel'),'Extent');
-    nskip=ceil(max(tlext(:,4))/xlext(4));
-    xlabel(cellstr([repmat('        ',nskip,1);'Response']));
-    clear nskip xlext tlext
-end
-ylabel('Value')
-
-if ~exist('lstr','var') || isempty(lstr)
-    lstr={'minimum' 'quartile 1' 'median' 'quartile 3' 'maximum'};
-end
-
-hleg1=legend(ax1,lstr,'Location','EastOutside',...
-             'Orientation','vertical','Interpreter','none');
-
-end
