bugGNU Octave - Bugs: bug #43282, annotation function missing

 
 

bug #43282: annotation function missing

Submitted by:  Tom Neilson <scadaminer>
Submitted on:  Tue 23 Sep 2014 12:31:16 AM UTC  
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  Pantxo Diribarne <pantxo>
Originator Name:  Tom Open/Closed:  Closed
Release:  3.8.2 Operating System:  Any

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)

Sun 22 Feb 2015 02:30:16 PM UTC, comment #21: 

I'm marking bug as fixed and closing report.  Adding a Qt menu item to dispatch to the annotation function is a different issue.  It can be reported as another bug, or maybe it just gets done by someone.  In any case, that issue is more of a Feature Request.

Rik <rik5>
Project Administrator
Sun 22 Feb 2015 10:39:15 AM UTC, comment #20: 

Thanks Rik, I pushed the changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/4569903d6c5a).
Should I leave this report open until annotations are added to the Qt figures menu?

Pantxo Diribarne <pantxo>
Project MemberIn charge of this item.
Sat 21 Feb 2015 07:24:04 PM UTC, comment #19: 

@Pantxo: If you think the cset improves the compatibility with Matlab go ahead and commit it.  I don't have time to review, but I trust you.

Rik <rik5>
Project Administrator
Sat 21 Feb 2015 11:02:24 AM UTC, comment #18: 

Hi,

I performed the following tests in Matlab 2013a:

clf;
ca1 = axes ();
ch = allchild (gcf ());
pos = find (ch == ca1);
h = annotation ('rectangle'); # Annotation drawn on top of the first axes
hover = get (h, 'parent');
ch = allchild (gcf ());
pos = [find(ch == ca1) find(ch == hover)] #-> [2 1]
ca2 = axes (); # Second axes drawn below the annotation
ch = allchild (gcf ());
pos = [find(ch == ca1) find(ch == hover) find(ch == ca2)] # ->[3 1 2]
axes (ca1); # First axes now covers the annotation
ch = allchild (gcf ());
pos = [find(ch == ca1) find(ch == hover) find(ch == ca2)] # ->[1 2 3]
set (ca2, 'handlevisibility', 'off');
axes (ca2); # Second axes now covers the annotation
ch = allchild (gcf ());
pos = [find(ch == ca1) find(ch == hover) find(ch == ca2)] # ->[2 3 1]
h = annotation ('rectangle'); # Annotations are back on top
ch = allchild (gcf ());
pos = [find(ch == ca1) find(ch == hover) find(ch == ca2)] # ->[3 1 2]

So my previous modifications of axes.m are not quite right ... the call form "axes (HAX)" restacks the figure children so that the annotation axes may be covered. This call form also restacks axes with "handlevisibility" == "off".
I attached a changeset that makes Octave behave as Matlab in all the above situations.

(file #33145)

Pantxo Diribarne <pantxo>
Project MemberIn charge of this item.
Tue 17 Feb 2015 11:57:43 PM UTC, comment #17: 

Hi,

I have pushed the patch (http://hg.savannah.gnu.org/hgweb/octave/rev/b8e4104a8f55).

@Rik: I don't know if annotation objects have a specific tag, but their parent axes has the same tag as is Octave: camel-cased "scribeoverlay". Now about the reordering in Matlab I'll test this tomorrow at work.

@John: I played with the attached toy function that adds an "Annotations" menu. I am no expert of mouse interaction in QtHandles, but this implementation is slow as you'll see. Annotation objects updates are quite slow by themselves but I am under the impression that they are run too often when using "WindowButtonMotionFcn".

(file #33112)

Pantxo Diribarne <pantxo>
Project MemberIn charge of this item.
Fri 13 Feb 2015 10:50:07 PM UTC, comment #16: 

@Panxto: I'm fine with the performance figures.  Plotting is something that is done on human time scales and the extra 40 milliseconds for 16 axes is not something of importance.  I think it's fine if jwe applies the patch and we start improving from there.

Some things to check with Matlab:

1) Is there a specific tag that annotation objects have
2) Does Matlab re-order the figure children to put annotation objects "on top"?

Rik <rik5>
Project Administrator
Fri 13 Feb 2015 09:11:05 PM UTC, comment #15: 

@John: I am ok with pushing the patch as is, can't do it my self so go ahead. I'll be following the bug tracker during the integration process anyway.

FTR, here is (I hope) the missing part:

Without patch
1 axes:         0.01 s
2 axes:         0.02 s
4 axes:         0.03 s
8 axes:         0.07 s
16 axes:        0.14 s
32 axes:        0.27 s

With patch
1 axes:         0.01 s
2 axes:         0.02 s
4 axes:         0.04 s
8 axes:         0.09 s
16 axes:        0.18 s
32 axes:        0.40 s

There is indeed a performance hit for a large number of axes in a figure. In
the mean time 30 axes in a figure is quite large.

I also noticed that if annotation function is called first in a figure, it
becomes the currentaxes which should not happen. I updated annotation.m to
take this into account.

@Michael: depends on when feature freeze is declared. Is there a proposed
date? I have no time now to cleanup the new patch but I may be able to post it
in the beginning of next week. Nevertheless if John wants to work on
integration, it will probably look like (or be) the attached
add_annotation2.patch. 

Pantxo Diribarne <pantxo>
Project MemberIn charge of this item.
Fri 13 Feb 2015 06:28:03 PM UTC, comment #14: 

Part of Pantxo's posting did not make into the bug tracker.

Among other things he said:
@Michael: depends on when feature freeze is declared. Is there a proposed
date? I have no time now to cleanup the new patch but I may be able to post it
in the beginning of next week. Nevertheless if John wants to work on
integration, it will probably look like (or be) the attached
add_annotation2.patch.

John: I would say apply the add_annotation2.patch, and
conside an update before 4.0 release if needed.

Michael Godfrey <godfrey>
Project Member
Fri 13 Feb 2015 06:19:26 PM UTC, comment #13: 

How about if I apply the patch as it is now and then we work on it from there?

John W. Eaton <jwe>
Project Administrator
Fri 13 Feb 2015 05:50:28 PM UTC, comment #12: 

@Rik: I ran the attached script with and without the patch (updated also to avoid findall function an a few quirks). It basically creates multiple axes on the same figure. The results are the following:

Pantxo Diribarne <pantxo>
Project MemberIn charge of this item.
Fri 13 Feb 2015 03:05:32 PM UTC, comment #11: 

Can this be done before freeze??

Michael Godfrey <godfrey>
Project Member
Thu 12 Feb 2015 09:34:31 PM UTC, comment #10: 

I'd also like to see this function added because I'd like to use it to add annotations with the Qt plot widget.

John W. Eaton <jwe>
Project Administrator
Tue 10 Feb 2015 11:43:19 PM UTC, comment #9: 

Hi,

The only involved change I can see is in axes.m: the function forces the annotation axes (when it exists) to always be on top of the figure children stack. This is the only way I could find to not have new axes be drawn over annotations. Without this annotations are hardly usable.

IMHO the patch is armless (provided I fix a find/replace error that is currently in the patch) but it adds a call to findall (may be slow) each time an axes is created.
I'll benchmark this performance issue and report back here. 

Pantxo Diribarne <pantxo>
Project MemberIn charge of this item.
Tue 10 Feb 2015 11:00:58 PM UTC, comment #8: 

Rik:  I read through the patch. It is almost entirely
made up of the new annotation function. Therefore,
it seems to me unlikely that it would introduce problems
with currently functional code.

And, having the annotation capability is a major plus.

I am pretty confident that Pantxo has tested the code.

So, I would recommend applying the patch.

p.s. The documentation is included in the patch !!

Michael

Michael Godfrey <godfrey>
Project Member
Tue 10 Feb 2015 10:48:41 PM UTC, comment #7: 

I don't have time to review.  At 44KB it looks like a large patch.  Should this go in before the 4.0 release, or is there a danger of de-stabilizing the plotting code because the changes are extensive?

Rik <rik5>
Project Administrator
Sun 08 Feb 2015 09:38:09 PM UTC, comment #6: 

Hi,

I attached a changeset that involves a bit more than adding annotation.m:

  • axes.m: ensure that the transparent annotation axes is always drawn on top of the other axes. 
  • clf.m: not only "clf reset" but also "clf" will delete the annotation axes (this is compatible with Matlab).

If no one has arguments against the additional changes, I'll push the patch soon.

(file #33033)

Pantxo Diribarne <pantxo>
Project MemberIn charge of this item.
Sat 29 Nov 2014 12:28:28 PM UTC, comment #5: 

I forgot to mention that the function only works in the default branch of dev version of Octave.

In order to have it work with Octave 3.8 (and gui-release branch) I could easily tweak some parts of the code to workaround some bugs that have been fixed in the default branch.

Pantxo Diribarne <pantxo>
Project MemberIn charge of this item.
Sat 29 Nov 2014 11:44:56 AM UTC, comment #4: 

Hi,

I attached a first implementation of the annotation function. The main limitations I can see are:

  • It doesn't work properly with gnuplot toolkit especially for textarrow and textbox objects (the "extent" property of text objects isn't enough accurate).
  • The "verticalalignment" property for textarrow objects has currently no effect.

I would appreciate if someone could test the function and reread the help string. Thanks in advance.

(file #32569)

Pantxo Diribarne <pantxo>
Project MemberIn charge of this item.
Wed 24 Sep 2014 04:20:53 AM UTC, comment #3: 

Thanks guys, I wasnt aware of the unimplemented.m file. @Pantxo, the annotation() function would be greatly appreciated.

Tom Neilson <scadaminer>
Tue 23 Sep 2014 07:54:14 AM UTC, comment #2: 

Hi,

I have a partial, draft implementation that I may be able to polish in the coming weeks. I'm assigning this bug to me to avoid duplicate effort.

Pantxo Diribarne <pantxo>
Project MemberIn charge of this item.
Tue 23 Sep 2014 07:06:43 AM UTC, comment #1: 

Hi Tom, there is quite a number of functions well known in Matlab that are not available in Octave. A complete list can be found in "__unimplemented__.m", so I think it is on the radar (more or less).

Armin Müller <arm_in>
Tue 23 Sep 2014 12:31:16 AM UTC, original submission:  

Annotation function is missing from Octave.  Apologies if there is an aobvious answer but I didn't find an explanation in any searches.
Code I am trying to run (from a Matlab script)

titleBox=annotation(figHandle,'textbox');

Response from Octave:
warning: the 'annotation' function is not yet implemented in Octave.

I will try to get around using annotation() by using other functions but just in case it has slipped off the radar, I am lodging it as a bug.
Regards,
Tom

Tom Neilson <scadaminer>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #33145:  fix_axes_behavior.patch added by pantxo (4KiB - text/x-diff)
file #33112:  add_annotation_menu.m added by pantxo (3KiB - text/x-objcsrc)
file #33062:  axes_benchmark.m added by pantxo (455B - text/x-objcsrc)
file #33063:  add_annotation2.patch added by pantxo (45KiB - application/x-download)
file #33033:  add_annotation.patch added by pantxo (44KiB - application/x-download)
file #32569:  annotation.m added by pantxo (38KiB - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    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.

     

     

     

    Follow 14 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-02-22 rik5 StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2015-02-21 pantxo Attached File- => Added fix_axes_behavior.patch, #33145
    2015-02-18 pantxo StatusIn Progress => Ready For Test
    2015-02-17 pantxo Attached File- => Added add_annotation_menu.m, #33112
    2015-02-13 pantxo Attached File- => Added axes_benchmark.m, #33062
        Attached File- => Added add_annotation2.patch, #33063
    2015-02-08 pantxo Attached File- => Added add_annotation.patch, #33033
    2014-11-29 pantxo Attached File- => Added annotation.m, #32569
    2014-09-24 rik5 StatusNone => In Progress
        Summaryannotation function => annotation function missing
    2014-09-23 pantxo CategoryOctave Function => Plotting
        Assigned toNone => pantxo
    2014-09-23 scadaminer Carbon-Copy- => Added tom.neilson@scadaminer.com

    Back to the top


    Powered by Savane 3.5