Tue 22 Oct 2013 07:30:52 PM UTC, comment #8:
Thanks for testing. I think this issue is settled.
|
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.
|
Tue 22 Oct 2013 03:51:02 PM UTC, comment #6:
Pantxo,
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?
|
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.
|
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)
|
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).
|
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.
|
Tue 20 Aug 2013 10:29:01 AM UTC, comment #1:
The obvious reason is the double use of 'parent' in l. 151
|
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.
|