bugGNU Octave - Bugs: bug #39483, axes "handlevisibility"...

 
 

bug #39483: axes "handlevisibility" not properly handled with new children objects

Submitter:  Pantxo Diribarne <pantxo>
Submitted:  Sun 14 Jul 2013 04:21:58 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.6.3 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 21 Jul 2013 03:03:04 PM UTC, comment #12: 

Indeed, it works fine after an update to 17028.

Pantxo Diribarne <pantxo>
Group Member
Sun 21 Jul 2013 02:51:05 PM UTC, comment #11: 

Is the regression still present after 17025:75d115e329b7?  (http://hg.savannah.gnu.org/hgweb/octave/rev/75d115e329b7)  I had noticed the same issue and checked in a change for it.  Your sample code works for me with 17025.

Rik <rik5>
Group administrator
Sun 21 Jul 2013 02:31:25 PM UTC, comment #10: 

I see a regression due to our patches. The following code doesn't work anymore:


close all;
hg = hggroup ();
li = line ("parent", hg);
get (hg, "children") == li


This should return true. Attached is a patch : if the parent handle points to an hggroup, the prop/val pair should not be deleted.

(file #28635)

Pantxo Diribarne <pantxo>
Group Member
Fri 19 Jul 2013 05:50:35 PM UTC, comment #9: 

Some (many?) high level functions also use gca() to store the current axes and reset it if a problem occured. I posted the new bug report at
https://savannah.gnu.org/bugs/?39529

Pantxo Diribarne <pantxo>
Group Member
Fri 19 Jul 2013 03:34:20 PM UTC, comment #8: 

Why don't you open a new bug report, just to be clear.  I'll probably still be the one who responds and commits your patches.

It seems like the "core" graphics objects which are low-level functions need to be checked.  Previously, they always used a call to gca() to plot into the current, or newly created, axis.  This can now be removed in favor of a call to _plt_get_axis_arg_ to check whether they are being re-parented.

The line.m function now reads:


## Get any axis argument which may be in a 'parent' PROP/VAL pair
[hax, varargin] = __plt_get_axis_arg__ ("line", varargin{:});

htmp = __line__ (hax, varargin{:});

if (nargout > 0)
  h = htmp;
endif


The core graphics objects which possibly need updating are:
axes
image
patch
rectangle
surface
text

Other functions, like surf, build upon these and probably do the right thing alread.

Rik <rik5>
Group administrator
Fri 19 Jul 2013 09:56:08 AM UTC, comment #7: 

Thanks. I can review the graphics functions that behave as line used to  and propose patches (for text.m at least ) if you think it's worth the effort. If so, should I post the patches here or open a new dedicated bug report?

Pantxo Diribarne <pantxo>
Group Member
Fri 19 Jul 2013 06:00:48 AM UTC, comment #6: 

I applied your two patches to the development branch of Octave.  I also followed it up with another changeset where I was able to simplify some of the tests.  strcmpi(), for example, does case insensitive matching (no need for tolower) and doesn't require that you check for character inputs first.  It knows that those are not strings and will return false for them.

Thanks for writing patches.  It makes thing a lot easier for the few maintainers who spend time watching the bug reports.

Rik <rik5>
Group administrator
Thu 18 Jul 2013 11:02:01 PM UTC, comment #5: 

The patch for plt_get_axis_arg.m is buggy. Attached is cleaner ... I hope.

(file #28613)

Pantxo Diribarne <pantxo>
Group Member
Wed 17 Jul 2013 09:39:33 PM UTC, comment #4: 

Yes I did test the first example in ML and it returns empty matrix. The problem has finally nothing to fo with "handlevisibility", but with the presence of a current axes. The following example also returns empty matrix for the current axes in ML:


close all
figure (1);
ax = axes ('parent', 1);
figure (2);
line ('parent', ax)
cf = get (0, 'currentfigure');
ca = get (cf, 'currentaxes');
disp (sprintf ('current figure: %d, current axes %f\n', cf, ca))


returns "current figure: 2, current axes  " (thus empty matrix), and "ax" has been populated with a new line with no axes creation in figure (2).

In octave a new axes is created in figure (2) before populating "ax" with the line, result : "current figure: 2, current axes -32.447683". An example patch for line.m is attached (which depends on the previous one).

(file #28607)

Pantxo Diribarne <pantxo>
Group Member
Wed 17 Jul 2013 03:07:50 PM UTC, comment #3: 

Do you have access to test this in Matlab?  I'm not sure that they will do anything different.  The documentation on handlevisibility doesn't make it clear what is supposed to happen in this case.

If your original example runs without creating an additional axis in the figure then we should look at changing how line() operates.

Rik <rik5>
Group administrator
Mon 15 Jul 2013 10:13:18 PM UTC, comment #2: 

In the example below "ax" handle is not visible and not the current axes as expected :


fig = figure (2345); clf
ax = axes ('parent', fig, 'handlevisibility', 'off');
get (gcf, "currentaxes")


Then, when "gca ()" is called in line.m (also text.m, image.m ...) a new axes is created.

Most plot functions (not line, but it probably could) use _plt_get_axis_arg_.m to parse input arguments and retrieve parent axes. The attached patch adds a search for "parent" property in _plt_get_axis_arg_.m. If present the prop/val pair is removed and the righ parent axes is returned. It works for hggroup where no call to "gca ()" is done:


fig = figure (2345); clf
ax = axes ('parent', fig, 'handlevisibility', 'off');
hg = hggroup ('parent', ax);
disp (sprintf ('Figure children list should be empty, result: '))
disp (get (fig, 'children'))

returns the empty matrix as expected. I think using this patch and replacing the calls to "gca ()" by "get (fig, "currentaxes")" in the various line, text... functions should work. Should I go ahead ?


(file #28589)

Pantxo Diribarne <pantxo>
Group Member
Sun 14 Jul 2013 04:24:58 PM UTC, comment #1: 

Sorry, a typo in verbatim ... the end of the report :


fig = figure (2345); clf
ax = axes ('parent', fig, 'handlevisibility', 'off');
ch = line ('parent', ax);
disp (sprintf ('Figure children list should be empty, result: '))
disp (get (fig, 'children'))


I tested with other types of objects (hggroup, image, text) and the result is
the same. Tested in dev and 3.6.3 octave versions

Pantxo Diribarne <pantxo>
Group Member
Sun 14 Jul 2013 04:21:58 PM UTC, original submission:  

When a new children is added to an axes which has its "handlevisibility" property set to "off", a new unused axes is created on top. The following code demonstrates this behavior :


fig = figure (2345); clf
ax = axes ('parent', fig, 'handlevisibility', 'off');
ch = line ('parent', ax);
disp (sprintf ('Figure children list should be empty, result: '))
disp (get (fig, 'children'))
-vertbatim-

I tested with other types of objects (hggroup, image, text) and the result is the same. Tested in dev and 3.6.3 octave versions

Pantxo Diribarne <pantxo>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #28635:  preserve_hggroup.diff added by pantxo (896B - text/x-patch)
file #28613:  get_parentaxes.diff added by pantxo (2KiB - text/x-patch)
file #28607:  line_avoid_gca.patch added by pantxo (797B - text/x-patch)
file #28589:  parse_plt_propval.patch added by pantxo (1KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-07-21 pantxo Attached File- Added preserve_hggroup.diff, #28635
    2013-07-19 rik5 StatusNone Fixed
        Open/ClosedOpen Closed
    2013-07-18 pantxo Attached File- Added get_parentaxes.diff, #28613
    2013-07-17 pantxo Attached File- Added line_avoid_gca.patch, #28607
    2013-07-15 pantxo Attached File- Added parse_plt_propval.patch, #28589

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code