octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pareto function


From: David Bateman
Subject: Re: pareto function
Date: Fri, 30 Nov 2007 10:35:25 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

John W. Eaton wrote:
> On 30-Nov-2007, David Bateman wrote:
> 
> | Its a bug the "-" is supposed to be an "=", as its possible to have a
> | negative values in the data, so we can pass the 95% confidence level
> | twice. However, thinking about it that fixed isn't enough. The attached
> | patch (which I committed) is needed..
> 
> After updating and doing
> 
>   demo pareto
>   ## interaction with demo (typing RET once) ...
>   x = -10:0.1:10; plot (x, sin(x))
> 
> the sin(x) plot appears on top of the pareto plot, but the bars of the
> pareto plot are gone.  Do you see the same or is it just me?  My
> current build does have some modifications to graphics.h.in and
> graphics.cc, but nothing that I think would cause this problem.
> 
> jwe
> 

That is normal. If you set "hold on" it should work as you want, except
that the scales on the y-axis are completely different and the sin curve
is not visible.. Something like

x = -10:0.1:10;
pareto(rand(1,21),-10:1:10)
hold on
plot(x, sin(x));

should work, but the attached patch is needed as there was a bug in the
pareto with numerical labels.

D.



Index: scripts/plot/__go_draw_axes__.m
===================================================================
RCS file: /usr/local/cvsroot/octave/scripts/plot/__go_draw_axes__.m,v
retrieving revision 1.78
diff -c -r1.78 __go_draw_axes__.m
*** scripts/plot/__go_draw_axes__.m     29 Nov 2007 23:14:08 -0000      1.78
--- scripts/plot/__go_draw_axes__.m     30 Nov 2007 09:30:23 -0000
***************
*** 1594,1602 ****
        else
          fprintf (plot_stream, "set %stics nomirror (", ax);
        endif
        for i = 1:ntics
!         fprintf (plot_stream, " \"%s\" %g", 
!                  regexprep (labels(k++), "%", "%%"), tics(i))
          if (i < ntics)
            fputs (plot_stream, ", ");
          endif
--- 1594,1602 ----
        else
          fprintf (plot_stream, "set %stics nomirror (", ax);
        endif
+       labels = regexprep(labels, "%", "%%");
        for i = 1:ntics
!         fprintf (plot_stream, " \"%s\" %g", labels{k++}, tics(i))
          if (i < ntics)
            fputs (plot_stream, ", ");
          endif
Index: scripts/plot/pareto.m
===================================================================
RCS file: /usr/local/cvsroot/octave/scripts/plot/pareto.m,v
retrieving revision 1.2
diff -c -r1.2 pareto.m
*** scripts/plot/pareto.m       29 Nov 2007 23:27:32 -0000      1.2
--- scripts/plot/pareto.m       30 Nov 2007 09:30:23 -0000
***************
*** 68,74 ****
        if (ischar (y))
        y = cellstr (y);
        else
!       y = num2cell (y);
        endif
      endif
    else
--- 68,74 ----
        if (ischar (y))
        y = cellstr (y);
        else
!       y = cellfun (@(x) num2str (x), num2cell (y), "UniformOutput", false);
        endif
      endif
    else
***************
*** 81,88 ****
    cdf = cumsum (x);
    maxcdf = max(cdf);
    cdf = cdf ./ maxcdf;
!   [dummy, idx95] = min (abs (cdf - .95));
!   idx95 = idx95(1);
  
    [ax, hbar, hline] = plotyy (ax, 1 : idx95, x (1 : idx95), 
                              1 : length(cdf), 100 .* cdf, 
--- 81,88 ----
    cdf = cumsum (x);
    maxcdf = max(cdf);
    cdf = cdf ./ maxcdf;
!   cdf95 = cdf - 0.95;
!   idx95 = find(sign(cdf95(1:end-1)) != sign(cdf95(2:end)))(1);
  
    [ax, hbar, hline] = plotyy (ax, 1 : idx95, x (1 : idx95), 
                              1 : length(cdf), 100 .* cdf, 
2007-11-30  David Bateman  <address@hidden>

        * plot/__go_draw_axes__.m (do_tics_1): regexprep the cell array of
        tick labels rather than one by one on the labels themselves.
        * plot/pareto.m: Bug in numerical labels fixed. Bug in search for
        95% crossing fixed.

        

reply via email to

[Prev in Thread] Current Thread [Next in Thread]