Hold doesn't work as expected in 3.0.3

Alexander Mamonov mamonov at gmail.com
Wed Oct 22 01:09:20 CDT 2008


The patch solved the problem for me.
Thank you very much,

Alexander

On Tue, Oct 21, 2008 at 9:03 PM, John W. Eaton <jwe at bevo.che.wisc.edu> wrote:
> On 21-Oct-2008, Alexander Mamonov wrote:
>
> | Bug report for Octave 3.0.3 configured for i486-pc-linux-gnu
> |
> | Description:
> | -----------
> |
> | Consider the following piece of code:
> |
> | figure(1); clf;
> | hold on;
> | title('ABC');
> | plot([1,2],[1,2],'b-');
> | plot([1,2],[2,1],'r-');
> |
> | Expected behavior is that Octave would turn hold on for the figure,
> | and each successive plot would not overwrite the previous one.
> | This is indeed the behavior in 3.0.1 and 3.0.2. But in 3.0.3 hold
> | is not turned on for some reason, and so only the last (red) line is displayed.
> |
> | Changing the order of commands to
> |
> | figure(1); clf;
> | title('ABC');
> | hold on;
> | plot([1,2],[1,2],'b-');
> | plot([1,2],[2,1],'r-');
> |
> | fixes the problem, however it requires making changes to numerous scripts
> | that used to work OK with the previous versions of Octave (and Matlab).
> |
> | Repeat-By:
> | ---------
> |
> | figure(1); clf;
> | hold on;
> | title('ABC');
> | plot([1,2],[1,2],'b-');
> | plot([1,2],[2,1],'r-');
>
> Please try the following patch.
>
> Jaroslav, this changeset should be applied to the 3.0.x branch.  It is
> a portion of changeset
>
>  changeset:   8075:a028a5960e18
>  user:        David Bateman <dbateman at free.fr>
>  date:        Fri Aug 29 15:48:44 2008 -0400
>  summary:     Fix for hold with no figures/axes. Set prop/val pairs to hggroups rather than underlying objects. Fix for equality test in array_property
>
> but I don't think the rest of it should be applied.
>
> Thanks,
>
> jwe
>
>
> # HG changeset patch
> # User David Bateman <dbateman at free.fr>
> # Date 1224640799 14400
> # Node ID 37792f740670bf7eeedbf6f7084cd2ba484e8317
> # Parent  f5f61487207c409cfeaf84d2ffed6531db4c0a3c
> Fix for hold with no figures/axes.
>
> diff --git a/scripts/ChangeLog b/scripts/ChangeLog
> --- a/scripts/ChangeLog
> +++ b/scripts/ChangeLog
> @@ -1,3 +1,7 @@
> +2008-08-29  David Bateman  <dbateman at free.fr>
> +
> +       * plot/hold.m: If currentaxes if figure doesn't exist, create it.
> +
>  2008-10-08  John W. Eaton  <jwe at octave.org>
>
>        * miscellaneous/fileparts.m: Handle "/file" properly.
> diff --git a/scripts/plot/hold.m b/scripts/plot/hold.m
> --- a/scripts/plot/hold.m
> +++ b/scripts/plot/hold.m
> @@ -69,6 +69,9 @@
>   endif
>
>   if (isfigure (h))
> +    if (isempty (get (h, "currentaxes")))
> +      set (h, "currentaxes", __go_axes__ (h))
> +    endif
>     axes_objs = findobj (h, "type", "axes");
>     h = [h; axes_objs];
>   endif
>
>


More information about the Bug-octave mailing list