|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Multiple bode plots fail on same figureHi,
It an easy to reproduce bug. Here's an example. ******************** clear all; [a1,b1] = butter( 7, [25, 41], 's'); [a2,b2] = butter( 7, [49, 81], 's'); bandpass_1 = tf( a1, b1); bandpass_2 = tf( a2, b2); figure(1); clf; bode( bandpass_1 ) hold on; bode( bandpass_2 ) ******************** The resulting figure has the phase plot of both system functions. But it only shows the magnitude plot of the last one to given. (in this case bandpass_2) Are there any solutions to this? I am using GNU Octave, version 3.0.1 Compiled from source on my gentoo system. (I have instaled the various octave-forge-* packages.) Greetings ANon5710 |
|
|
Re: Multiple bode plots fail on same figureOn Jun 27, 2008, at 7:23 PM, Anon5710 wrote: > > Hi, > > It an easy to reproduce bug. > Here's an example. > > ******************** > clear all; > [a1,b1] = butter( 7, [25, 41], 's'); > [a2,b2] = butter( 7, [49, 81], 's'); > bandpass_1 = tf( a1, b1); > bandpass_2 = tf( a2, b2); > figure(1); > clf; > bode( bandpass_1 ) > hold on; > bode( bandpass_2 ) > ******************** > > The resulting figure has the phase plot of both system functions. > But it > only shows the magnitude plot of the last one to given. (in this case > bandpass_2) > > Are there any solutions to this? > > I am using GNU Octave, version 3.0.1 > Compiled from source on my gentoo system. (I have instaled the various > octave-forge-* packages.) Octave 3.0.1 includes the property "nextplot" for each axis. I understand that "hold on" only respects the current axis, not the current figure. So there is no bug (if I'm wrong feel free to correct me) ... however the help text for "hold" appears to be in need of clarity. To get the effect you're looking for try replacing "hold on" with ... set (findobj (gcf, "type", "axes"), "nextplot", "add") The equivalent to "hold off" is set (findobj (gcf, "type", "axes"), "nextplot", "replace") Alternatively, you can use hold (findobj (gcf, "type", "axes"), "on") hold (findobj (gcf, "type", "axes"), "off") Ben _______________________________________________ Bug-octave mailing list Bug-octave@... https://www.cae.wisc.edu/mailman/listinfo/bug-octave |
|
|
Re: [patch] - trivial patch to doc text - Multiple bode plots fail on same figurePlease consider the attached change set to the doc text for hold.m
I notice that the current implementation does not respect "hold all". Unfortunately, I haven't the time needed to work on that. Ben # HG changeset patch # User Ben Abbott <bpabbott@...> # Date 1214613508 14400 # Node ID d0a5e7dd4c1117464b12b0c5404b897e2f40e8ca # Parent d56511a0288475622cb5b76725cafdbc09f000bb hold.m: Trival mod to help text. diff -r d56511a02884 -r d0a5e7dd4c11 scripts/ChangeLog --- a/scripts/ChangeLog Thu Jun 26 16:06:14 2008 -0400 +++ b/scripts/ChangeLog Fri Jun 27 20:38:28 2008 -0400 @@ -1,3 +1,7 @@ +2008-06-27 Ben Abbott <bpabbott@...> + + * plot/hold.m: Clarify help text. + 2008-06-11 John W. Eaton <jwe@...> * set/ismember.m: Fix fail tests. diff -r d56511a02884 -r d0a5e7dd4c11 scripts/plot/hold.m --- a/scripts/plot/hold.m Thu Jun 26 16:06:14 2008 -0400 +++ b/scripts/plot/hold.m Fri Jun 27 20:38:28 2008 -0400 @@ -18,9 +18,9 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} hold @var{args} -## Tell Octave to `hold' the current data on the plot when executing +## Tell Octave to `hold' the current data on the graph when executing ## subsequent plotting commands. This allows you to execute a series of -## plot commands and have all the lines end up on the same figure. The +## plot commands and have all the lines end up on the same graph. The ## default is for each new plot command to clear the plot device first. ## For example, the command ## @@ -32,6 +32,12 @@ ## turns the hold state on. An argument of @code{"off"} turns the hold ## state off, and @code{hold} with no arguments toggles the current hold ## state. +## +## @deftypefnx {Function File} {} hold (@var{h}, @dots{}) +## +## Applies to a specific axis or axes, associated with the handle(s), +## @var{h}. +## ## @end deftypefn ## PKG_ADD: mark_as_command hold _______________________________________________ Bug-octave mailing list Bug-octave@... https://www.cae.wisc.edu/mailman/listinfo/bug-octave |
|
|
Re: [patch] - trivial patch to doc text - Multiple bode plots fail on same figureOn 27-Jun-2008, Ben Abbott wrote:
| Please consider the attached change set to the doc text for hold.m I applied it. Thanks, jwe _______________________________________________ Bug-octave mailing list Bug-octave@... https://www.cae.wisc.edu/mailman/listinfo/bug-octave |
|
|
Multiple bode plots fail on same figureOn 27-Jun-2008, Anon5710 wrote:
| It an easy to reproduce bug. | Here's an example. | | ******************** | clear all; | [a1,b1] = butter( 7, [25, 41], 's'); | [a2,b2] = butter( 7, [49, 81], 's'); | bandpass_1 = tf( a1, b1); | bandpass_2 = tf( a2, b2); | figure(1); | clf; | bode( bandpass_1 ) | hold on; | bode( bandpass_2 ) | ******************** | | The resulting figure has the phase plot of both system functions. But it | only shows the magnitude plot of the last one to given. (in this case | bandpass_2) | | Are there any solutions to this? | | I am using GNU Octave, version 3.0.1 | Compiled from source on my gentoo system. (I have instaled the various | octave-forge-* packages.) I think this problem is happening because Octave is not handling the nextplot property correctly for figures (and the hold function is not even setting it, which I think it should). Here is a simpler example that demonstrates the problem (no need for butter, tf, or bode): x = -10:0.1:10; subplot (2, 1, 1); plot (x, sin(x)); subplot (2, 1, 2); plot (x, sin(x)); hold ("on"); subplot (2, 1, 1); plot (x, cos(x)); subplot (2, 1, 2); plot (x, cos(x)); I don't know the proper fix for this. I could use some help from someone who understands just how the nextplot properties for figure and axes objects are supposed to work. Thanks, jwe _______________________________________________ Bug-octave mailing list Bug-octave@... https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave |
|
|
Re: Multiple bode plots fail on same figureOn 27-Jun-2008, Ben Abbott wrote:
| Octave 3.0.1 includes the property "nextplot" for each axis. I | understand that "hold on" only respects the current axis, not the | current figure. So there is no bug (if I'm wrong feel free to correct | me) ... however the help text for "hold" appears to be in need of | clarity. | | To get the effect you're looking for try replacing "hold on" with ... | | set (findobj (gcf, "type", "axes"), "nextplot", "add") | | The equivalent to "hold off" is | | set (findobj (gcf, "type", "axes"), "nextplot", "replace") | | Alternatively, you can use | | hold (findobj (gcf, "type", "axes"), "on") | | hold (findobj (gcf, "type", "axes"), "off") Sorry, I missed this reply initially. OK, so hold should probably be doing this to change the property for all child axes of the current figure. How about the following patch? Thanks, jwe # HG changeset patch # User John W. Eaton <jwe@...> # Date 1219788313 14400 # Node ID 6333da0dfdfde7945fd8bfc13a36789358042027 # Parent 4f1ebb704545e5dba92380e98c020d3fe293eef4 hold.m: if hold is applied to a figure, set state for all child axes objects diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2008-08-26 John W. Eaton <jwe@...> + + * plot/hold.m: If hold is applied to a figure, set state for all + child axes objects. + 2008-08-26 Michael Goffioul <michael.goffioul@...> * plot/backend.m: New function to handle backend switch. diff --git a/scripts/plot/hold.m b/scripts/plot/hold.m --- a/scripts/plot/hold.m +++ b/scripts/plot/hold.m @@ -44,11 +44,14 @@ function hold (varargin) - [h, varargin] = __plt_get_axis_arg__ ("hold", varargin{:}); + if (nargin > 0 && ishandle (varargin{1})) + [h, varargin, nargs] = __plt_get_axis_arg__ ("hold", varargin{:}); + else + h = gcf (); + nargs = numel (varargin); + endif hold_state = get (h, "nextplot"); - - nargs = numel (varargin); if (nargs == 0) if (strcmp (hold_state, "add")) @@ -71,6 +74,11 @@ print_usage (); endif + if (isfigure (h)) + axes_objs = findobj (h, "type", "axes"); + h = [h; axes_objs]; + endif + set (h, "nextplot", hold_state); endfunction _______________________________________________ Bug-octave mailing list Bug-octave@... https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave |
|
|
Re: Multiple bode plots fail on same figureOn Aug 26, 2008, at 6:05 PM, John W. Eaton wrote: > On 27-Jun-2008, Ben Abbott wrote: > > | Octave 3.0.1 includes the property "nextplot" for each axis. I > | understand that "hold on" only respects the current axis, not the > | current figure. So there is no bug (if I'm wrong feel free to > correct > | me) ... however the help text for "hold" appears to be in need of > | clarity. > | > | To get the effect you're looking for try replacing "hold on" > with ... > | > | set (findobj (gcf, "type", "axes"), "nextplot", "add") > | > | The equivalent to "hold off" is > | > | set (findobj (gcf, "type", "axes"), "nextplot", "replace") > | > | Alternatively, you can use > | > | hold (findobj (gcf, "type", "axes"), "on") > | > | hold (findobj (gcf, "type", "axes"), "off") > > > Sorry, I missed this reply initially. > > OK, so hold should probably be doing this to change the property for > all child axes of the current figure. How about the following patch? > I did a quick build and simple test. All looks good here! Thanks _______________________________________________ Bug-octave mailing list Bug-octave@... https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave |
| Free embeddable forum powered by Nabble | Forum Help |