bugGNU Octave - Bugs: bug #66735, legend object not correctly copied...

 
 

bug #66735: legend object not correctly copied by copyobj()

Submitter:  Liang Tang <lt1234>
Submitted:  Wed 29 Jan 2025 04:03:43 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  lt1234 Open/Closed:  * Open
Release:  * 9.3.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 05 Feb 2025 10:25:52 PM UTC, comment #1: 

The example is quite complicated and won't work because it modifies the "tag" property of the legend objects.  As documented in the help text for legend, Octave implements legends as axes objects ("type" = "axes") with the "tag" field set to "legend".

However, there is something wrong going on because the original legend object is not being correctly copied.  Adding Pantxo to the CC list for this bug report in case he sees something obvious.

Minimum working example


close all

plot (10:-1:1, 'o-');
hl = legend ('ABC');
legend ('boxoff');
title ("Original plot");

hf2 = copyobj (gcf);
figure (hf2);
title ("copyobj plot");


The copied legend object does not have the "tag"="legend".  It is also missing the "string" property.  The axes border is also incorrect.  It seems like maybe copyobj is directly copying the axes object which makes up the legend in the original plot, but none of the functionality.

(file #56851)

Rik <rik5>
Group administrator
Wed 29 Jan 2025 04:03:43 PM UTC, original submission:  

A zip is attached for the m file and results (ofig and screen catch) from 8.2 and 9.3. 

I ran 8.2 and 9.3 and observed differences in

(1) axis box
(2) legend

8.2 (legend missing)
9.3 (legend incorrectly placed and axes box added)


Liang Tang <lt1234>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #56851:  tst_copyobj_leg.m added by rik5 (158B - text/x-objcsrc)
file #56830:  test_copyobj.zip added by lt1234 (187KiB - application/x-zip-compressed)

 

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 rik5
  • -email is unavailable- added by lt1234 (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
    2025-02-05 rik5 Attached File- Added tst_copyobj_leg.m, #56851
        StatusNone Confirmed
        Operating SystemMicrosoft Windows Any
        Summarycopyobj display different legend and axes box legend object not correctly copied by copyobj()
        Carbon-Copy- Added pantxo
    2025-01-29 lt1234 Attached File- Added test_copyobj.zip, #56830

    Back to the top

    Powered by Savane 3.14-9aa3.
    Corresponding source code