help-octave
[Top][All Lists]
Advanced

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

Re: bar and hist


From: David Bateman
Subject: Re: bar and hist
Date: Tue, 06 Nov 2007 13:59:44 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

Evan wrote:
> On Nov 5, 2007 5:48 PM, David Bateman <address@hidden> wrote:
>   
>> Evan wrote:
>>     
>>> On 10/31/07, kahacjde <address@hidden> wrote:
>>>
>>>       
>>>> Hello,
>>>>
>>>> bar and hist are using 'patch' graphic objects now. You have to change the
>>>> patch properties like this:
>>>>
>>>> h = bar(rand(10,1));
>>>> set(h,'FaceColor','yellow','EdgeColor',[0.2 0.7 0.4]);
>>>>
>>>> or in one line
>>>>
>>>> bar(rand(10,1), 'FaceColor', 'yellow', 'EdgeColor', [0.2 0.7 0.4]);
>>>>
>>>> Kai
>>>>
>>>>         
>>> It seems that this doesn't work for hist
>>>
>>>       
>> This works fine for me.. All of the additional arguments to bar are
>> passed to the underlying patch command.. So this should work..
>>
>>     
>
> Could you please give me an example, or refer me to the document.
> I cannot get it work in that way.
>
>   
Ok, I tested for bar and not hist.. Yes in hist the additional arguments
are not passed not.. Here is a patch that addresses this

D.


-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

*** ./scripts/plot/hist.m.orig3 2007-11-06 13:56:45.263951652 +0100
--- ./scripts/plot/hist.m       2007-11-06 13:55:49.380842525 +0100
***************
*** 43,51 ****
  
  ## Author: jwe
  
! function [nn, xx] = hist (y, x, norm)
  
!   if (nargin < 1 || nargin > 3)
      print_usage ();
    endif
  
--- 43,51 ----
  
  ## Author: jwe
  
! function [nn, xx] = hist (y, varargin)
  
!   if (nargin < 1)
      print_usage ();
    endif
  
***************
*** 62,73 ****
      error ("hist: first argument must be a vector");
    endif
  
!   if (nargin == 1)
      n = 10;
      x = [0.5:n]'/n;
      x = x * (max_val - min_val) + ones(size(x)) * min_val;
    else
      ## nargin is either 2 or 3
      if (isscalar (x))
        n = x;
        if (n <= 0)
--- 62,75 ----
      error ("hist: first argument must be a vector");
    endif
  
!   iarg = 1;
!   if (nargin == 1 || ischar (varargin{iarg}))
      n = 10;
      x = [0.5:n]'/n;
      x = x * (max_val - min_val) + ones(size(x)) * min_val;
    else
      ## nargin is either 2 or 3
+     x = varargin {iarg++};
      if (isscalar (x))
        n = x;
        if (n <= 0)
***************
*** 113,120 ****
  
    freq = diff (chist);
  
!   if (nargin == 3)
      ## Normalise the histogram.
      freq = freq / rows (y) * norm;
    endif
  
--- 115,123 ----
  
    freq = diff (chist);
  
!   if (nargin > 2 && !ischar (varargin{iarg}))
      ## Normalise the histogram.
+     norm = varargin{iarg++};
      freq = freq / rows (y) * norm;
    endif
  
***************
*** 127,133 ****
        xx = x;
      endif
    else
!     bar (x, freq, 1.0);
    endif
  
  endfunction
--- 130,136 ----
        xx = x;
      endif
    else
!     bar (x, freq, 1.0, varargin{iarg:end});
    endif
  
  endfunction
2007-11-06  David Bateman  <address@hidden>

        * plot/hist.m: Pass any additional arguments to bar for treatment.

reply via email to

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