[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Add base value support to bars
From: |
John W. Eaton |
Subject: |
Add base value support to bars |
Date: |
Tue, 18 Dec 2007 16:05:39 -0500 |
On 18-Dec-2007, Michael Goffioul wrote:
| The following patch adds support for a base value in bar functions. Note
| that I'm not sure about the expected behavior in case of stacked bars, as
| I don't have Matlab under the hand to check it.
|
| Michael.
|
| Index: scripts/plot/__bar__.m
| ===================================================================
| RCS file: /cvs/octave/scripts/plot/__bar__.m,v
| retrieving revision 1.14
| diff -c -r1.14 __bar__.m
| *** scripts/plot/__bar__.m 29 Nov 2007 16:44:45 -0000 1.14
| --- scripts/plot/__bar__.m 18 Dec 2007 20:49:00 -0000
| ***************
| *** 27,32 ****
| --- 27,33 ----
| ## Slightly smaller than 0.8 to avoid clipping issue in gnuplot 4.0
| width = 0.8 - 10 * eps;
| group = true;
| + bv = 0;
|
| if (nargin < 3)
| print_usage ();
| ***************
| *** 87,92 ****
| --- 88,97 ----
| width = varargin{idx++};
| elseif (idx == nargin - 2)
| newargs = [newargs,varargin(idx++)];
| + elseif (isstr (varargin{idx}) && strcmp (tolower
| (varargin{idx}), "basevalue") &&
| + isscalar (varargin{idx+1}))
| + bv = varargin{idx+1};
| + idx += 2;
| else
| newargs = [newargs,varargin(idx:idx+1)];
| idx += 2;
| ***************
| *** 122,132 ****
| xb(2:4:4*ylen,:) += offset;
| xb(3:4:4*ylen,:) += offset;
| xb(4:4:4*ylen,:) += offset;
| ! y0 = zeros (size (y));
| y1 = y;
| else
| y1 = cumsum(y,2);
| ! y0 = [zeros(ylen,1), y1(:,1:end-1)];
| endif
|
| yb = zeros (4*ylen, ycols);
| --- 127,137 ----
| xb(2:4:4*ylen,:) += offset;
| xb(3:4:4*ylen,:) += offset;
| xb(4:4:4*ylen,:) += offset;
| ! y0 = zeros (size (y)) + bv;
| y1 = y;
| else
| y1 = cumsum(y,2);
| ! y0 = [zeros(ylen,1)+bv, y1(:,1:end-1)];
| endif
|
| yb = zeros (4*ylen, ycols);
| ***************
| *** 145,151 ****
| newplot ();
|
| tmp = __bars__ (h, vertical, x, y, xb, yb, width, group,
| ! have_line_spec, newargs{:});
| if (nargout == 1)
| varargout{1} = tmp;
| endif
| --- 150,156 ----
| newplot ();
|
| tmp = __bars__ (h, vertical, x, y, xb, yb, width, group,
| ! have_line_spec, bv, newargs{:});
| if (nargout == 1)
| varargout{1} = tmp;
| endif
| Index: scripts/plot/__bars__.m
| ===================================================================
| RCS file: /cvs/octave/scripts/plot/__bars__.m,v
| retrieving revision 1.3
| diff -c -r1.3 __bars__.m
| *** scripts/plot/__bars__.m 28 Nov 2007 02:32:42 -0000 1.3
| --- scripts/plot/__bars__.m 18 Dec 2007 20:49:00 -0000
| ***************
| *** 20,26 ****
|
| ## Author: jwe
|
| ! function tmp = __bars__ (h, vertical, x, y, xb, yb, width, group,
| have_color_spec, varargin)
|
| ycols = columns (y);
| clim = get (h, "clim");
| --- 20,26 ----
|
| ## Author: jwe
|
| ! function tmp = __bars__ (h, vertical, x, y, xb, yb, width, group,
| have_color_spec, base_value, varargin)
|
| ycols = columns (y);
| clim = get (h, "clim");
This patch adds a base_value argument to __bars__ but I don't see
where it is used. If it is not used, why add it? What am I missing?
When you send patches directly in your messages, they often arrive
with long lines wrapped. Can you send them as text/plain attachments
to avoid that?
jwe