bugGNU Octave - Bugs: bug #65442, legend.m fails on polar plot when...


bug #65442: legend.m fails on polar plot when executed more than one time

Submitter:  None
Submitted:  Sun 10 Mar 2024 10:30:13 AM UTC
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Luchika De Sousa Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 8.4.0
Operating System:  * Any Fixed Release:  9.2.0 (current stable)
Planned Release:  9.2.0 (current stable)
* Mandatory Fields

Add a New Comment Rich Markup

Jump to the original submission

Sat 06 Apr 2024 12:24:37 AM UTC, comment #15: 

Great.  I pushed the fix to the stable branch.  I'm going to close this report as Fixed.

Rik <rik5>
Group administrator
Fri 05 Apr 2024 08:59:02 PM UTC, comment #14: 

@Rik: Sorry for the late reply. Yes please, push your patch that fixes the issue at hand. I'll work out a patch to make the example from comment #11 work later.

Pantxo Diribarne <pantxo>
Group Member
Thu 04 Apr 2024 06:35:14 PM UTC, comment #13: 

@Pantxo: Do you want to apply your patch, even if incomplete, to resolve this bug?  Or should I apply mine and you can overwrite it when yours is ready?

Given that this is a bug and needs to be fixed on stable, while additional functionality should go on the development branch, you might want to split the patch anyways or just apply mine right now to stable.

Rik <rik5>
Group administrator
Tue 26 Mar 2024 09:43:48 PM UTC, comment #12: 

If you have a better patch I think it's fine to apply it.  My work was really just to fix this with the minimum amount of effort.

Rik <rik5>
Group administrator
Thu 21 Mar 2024 08:50:13 PM UTC, comment #11: 

@Rik: I have a work in progress patch (see attached). It currently solves the issues at hand but I have been trying to make the following example work as in ML:

clf; hold on;

h1 = plot (1:10, "displayname", "visible");
h2 = plot (10*rand (1,10), "handlevisibility", "off", ...
           "displayname", "invisible");

legend () ## Only the first line has a legend

legend ([h1 h2]) ## Both lines now have a legend

disp ("Click any key to add a new visible item")
h3 = plot (10*rand (1,10), "displayname", "visible");
## The second item should not disappear

I.e. objects with invisible handles don't get a legend by default  (that works) but one should be able to add a legend to a purposely invisible object (that works) ans the automatic update for further item addition should not remove it (that still doesn't work).

(file #55877)

Pantxo Diribarne <pantxo>
Group Member
Wed 20 Mar 2024 01:19:23 AM UTC, comment #10: 

The attached cset seems to work for me.  Marking as "Patch Submitted".

(file #55868)

Rik <rik5>
Group administrator
Wed 20 Mar 2024 12:31:16 AM UTC, comment #9: 

With patch, it seems that the second invocation is picking the wrong line object for label 'a'.  It seems to be picking one of the gray line objects making up the polar axes.  Later, setting the "RhoTicks" property causes the line segment to go blank.

Rik <rik5>
Group administrator
Wed 13 Mar 2024 09:38:27 PM UTC, comment #8: 

The patch prevents an error, but it seems as if the first line object in the legend is no longer being labeled.

Rik <rik5>
Group administrator
Tue 12 Mar 2024 07:54:17 PM UTC, comment #7: 

Thanks for the review. I attached an updated patch as per Markus' suggestion.

(file #55829)

Pantxo Diribarne <pantxo>
Group Member
Tue 12 Mar 2024 02:22:56 PM UTC, comment #6: 

I confirm that patch from Pantxo works also here. Just fix for the coding pattern highlighted by Markus. Thank you!

Tue 12 Mar 2024 08:48:08 AM UTC, comment #5: 

Your patch looks good to me in general.
Just a minor remark with respect to the general coding pattern when it comes to unwind_protect-blocks: Afaict, variables that are used in the unwind-section are usually defined before the start of the protected section of the code.
Could you please move the line that defines `hvisibility` to before `unwind_protect`?

Markus M├╝tzel <mmuetzel>
Group administrator
Mon 11 Mar 2024 08:29:55 PM UTC, comment #4: 

The problem is that the legend function assumes that "showhiddenhandles" is off. The attached patch fixes the issue for me.

(file #55827)

Pantxo Diribarne <pantxo>
Group Member
Mon 11 Mar 2024 01:58:43 PM UTC, comment #3: 

Sorry Dmitri and Philip, you're right, the problem is probably related to other stuff I'm performing to make a dB-scale polar plot. Please, check this new bug2.m script I attached.


(file #55823)

Sun 10 Mar 2024 04:50:01 PM UTC, comment #2: 

I can't reproduce it on Windows 10 either, using 8.4.0, an older dev version of 9.0.0, and a recent 10.0.0 Octave version.

Philip Nienhuis <philipnienhuis>
Group Member
Sun 10 Mar 2024 02:54:53 PM UTC, comment #1: 

I cannot reproduce this with octave 7.3, 8.4, nor with the latest pre-release 9.0.91.

I suspect there is something in your environment that interfere.

Remove "cls" from your script it my hide some error/warning messages. 


Dmitri A. Sergatskov <dasergatskov>
Sun 10 Mar 2024 10:30:13 AM UTC, original submission:  

legend.m fails on polar plot when a script is executed for the second, third, etc. time, while at first run it runs as expected.

This is the error reported:

error: get: unknown text property peer_object
error: called from
    legend>texticon_objects at line 971 column 20
    legend>update_layout_cb at line 925 column 15
    legend at line 303 column 5
    bug at line 6 column 1

Steps to reproduce the bug:
- Download attached script (bug.m)
- Run it, you should see a polar plot with three circles and a legend correctly naming them as a, b and c.
- Run the script again, now the error reported above should appear.
- If you close and reopen GNU Octave the above behavior will repeat again.



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

Attach Files:

Attached Files
file #55877:  bug65442_3.patch added by pantxo (3KiB - text/x-patch)
file #55868:  65442.cset added by rik5 (1KiB - application/octet-stream)
file #55832:  bug2.nopatch.png added by rik5 (46KiB - image/png)
file #55833:  bug2.patch.png added by rik5 (45KiB - image/png)
file #55829:  bug65442_2.patch added by pantxo (1KiB - text/x-patch)
file #55827:  bug65442.patch added by pantxo (1KiB - text/x-patch)
file #55823:  bug2.m added by None (719B - application/octet-stream)
file #55819:  bug.m added by None (168B - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


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

    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 17 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-04-06 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone 9.2.0 (current stable)
    2024-03-21 pantxo Attached File- Added bug65442_3.patch, #55877
    2024-03-20 rik5 Attached File- Added 65442.cset, #55868
        StatusPatch Reviewed Patch Submitted
        Planned ReleaseNone 9.2.0 (current stable)
    2024-03-13 rik5 Attached File- Added bug2.nopatch.png, #55832
        Attached File- Added bug2.patch.png, #55833
        StatusPatch Submitted Patch Reviewed
    2024-03-12 pantxo Attached File- Added bug65442_2.patch, #55829
    2024-03-11 pantxo Attached File- Added bug65442.patch, #55827
        CategoryOctave Function Plotting with OpenGL
        StatusNone Patch Submitted
        Operating SystemMicrosoft Windows Any
    2024-03-11 None Attached File- Added bug2.m, #55823
    2024-03-10 None Attached File- Added bug.m, #55819

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code