bugGNU Octave - Bugs: bug #39813, rectangle(..., 'Parent', hg) not...


bug #39813: rectangle(..., 'Parent', hg) not working for group objects

Submitted by:  Muhali <muhali>
Submitted on:  Mon 19 Aug 2013 09:04:13 AM UTC  
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  Rik <rik5>
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  GNU/Linux

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Tue 22 Oct 2013 07:30:52 PM UTC, comment #8:

Thanks for testing. I think this issue is settled.

Rik <rik5>
Project AdministratorIn charge of this item.
Tue 22 Oct 2013 06:39:47 PM UTC, comment #7:

For your test: only "ishandle (li0)" returns false.

The rule I could draw is:
- if hgsave is an axes: children are deleted, brothers preserved
- else: all the ancestor axes' children are deleted except the oldest (gran)parent of hgsave with all its descendance (including hgsave's (gran)uncles and brothers).

See the result of the following test

This is also what we currently obtain in octave with the most recent changesets you pushed.

Pantxo Diribarne <pantxo>
Project Member
Tue 22 Oct 2013 03:51:02 PM UTC, comment #6:


I applied your patch for newplot and _plt_get_axis__arg_. To get everything to work I had to modify the strategy a bit. _plt_get_axis_arg_ now always returns a valid axis handle in the first position, and any other handles, such as an hggroup handle, come afterwards. This keeps existing routines working. newplot() was modified to accept a vector of handles instead of just a single handle. I also copied the code that searches for handles to save from the "replace" case to the "replacechildren" case as well since that seemed reasonable. Finally, with those changes in place I was able to fix this bug. The three changesets are <http://hg.savannah.gnu.org/hgweb/octave/rev/ed9a21a90221>, <http://hg.savannah.gnu.org/hgweb/octave/rev/1ab8e21d9cfc>, <http://hg.savannah.gnu.org/hgweb/octave/rev/f0bc865db55f>.

Final question, did you test the save handle code in newplot against Matlab? The current code saves uncles, as well as parents, along the tree from the toplevel figure down to a saved handle. It seems more reasonable, although perhaps harder to code, to save only the direct path from figure down to saved handle.

Using the test code from newplot that you wrote:

Does li1 exist at this point [ishandle (li1)] since it is an uncle to hg2? Or does the Matlab newplot keep only hf->hax->hg1->hg2. And does Matlab newplot preserve the children of the saved handle [ishandle (li2)] or just the actual named handle li2 and its parents?

Rik <rik5>
Project AdministratorIn charge of this item.
Wed 09 Oct 2013 01:47:52 PM UTC, comment #5:

Pantxo, I think your analysis is correct. I need to think a bit about the problem before committing your patch.

Rik <rik5>
Project AdministratorIn charge of this item.
Mon 23 Sep 2013 05:57:13 PM UTC, comment #4:

As an implementation example, attached is a patch:
- newplot is modified to accept and preserve any kind of input handle
- _get_axis_args_ is modified to return the parent handle when one is specified in prop/val pairs. The new behavior is contradictory with the function name, which maybe confusing.

Tests in scripts/plot still pass.

(file #29204)

Pantxo Diribarne <pantxo>
Project Member
Sun 22 Sep 2013 06:06:37 PM UTC, comment #3:

I think the problem lies in the use of "newplot" : when the axes "nextplot" property has value "replace" (which is the case by default), all the axes children including the hggroup are deleted. The following code works well for me:

The newplot function should probably be called with the parent handle as hsave argument (whether an axes or a hggroup). A way to achieve this could be to have plt_get_axis_arg return an additionnal argument HPAR (parent handle).

Pantxo Diribarne <pantxo>
Project Member
Mon 09 Sep 2013 11:56:09 PM UTC, comment #2:

The problem, not quite sure how to resolve it, is with _plt_get_axis_arg_ which is grabbing the parent/handle property and interpreting it to mean the axis handle of hg.

Rik <rik5>
Project AdministratorIn charge of this item.
Tue 20 Aug 2013 10:29:01 AM UTC, comment #1:

The obvious reason is the double use of 'parent' in l. 151

Muhali <muhali>
Mon 19 Aug 2013 09:04:13 AM UTC, original submission:

Defining a group object as a 'Parent' to the rectangle function does not work, e.g.

This may be related to this bug.

Muhali <muhali>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #29204:  newplot_get_plt.diff added by pantxo (3KiB - text/x-patch)


   bug dependencies.

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by muhali (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    Tue 22 Oct 2013 03:51:02 PM UTC rik5 StatusIn Progress => Fixed
        Open/ClosedOpen => Closed
    Thu 17 Oct 2013 06:02:10 PM UTC rik5 StatusConfirmed => In Progress
        Assigned toNone => rik5
    Wed 09 Oct 2013 01:48:33 PM UTC rik5 Dependencies- => Depends on bugs #40214
    Mon 23 Sep 2013 05:57:12 PM UTC pantxo Attached File- => Added newplot_get_plt.diff, #29204
    Mon 09 Sep 2013 11:56:24 PM UTC rik5 StatusNeed Info => Confirmed
    Mon 09 Sep 2013 11:56:09 PM UTC rik5 StatusNone => Need Info
    Wed 04 Sep 2013 05:49:13 AM UTC mtmiller CategoryNone => Plotting
        Item GroupNone => Incorrect Result

    Back to the top

    Powered by Savane 3.3