octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #60792] legend function returns too few object


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #60792] legend function returns too few objects in different order compared to Matlab
Date: Thu, 17 Jun 2021 14:23:55 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0

URL:
  <https://savannah.gnu.org/bugs/?60792>

                 Summary: legend function returns too few objects in different
order compared to Matlab
                 Project: GNU Octave
            Submitted by: philipnienhuis
            Submitted on: Thu 17 Jun 2021 08:23:53 PM CEST
                Category: Plotting
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Philip Nienhuis
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

(I couldn't find an earlier mention of this in the bug tracker. hopefully it
isn't a duplicate - there are many legend-related bugs in the tracker)

Consider this little script + results:
Octave-7.0.0 (crossbuilt June 15):

x = 1:10;
h = plot (x, sin (x), x, cos (x));
[~, obj] = legend (h(:), {'sin', 'cos'});
for ii=1:numel (obj)
  get (obj(ii), 'type')
end
ans = text
ans = line
ans = text
ans = line


... and the the same script in Matlab r2014a & r2020b:

>> x = 1:10;
h = plot (x, sin (x), x, cos (x));
[~, obj] = legend (h(:), {'sin', 'cos'});
for ii=1:numel (obj)
  get (obj(ii), 'type')
end
ans =
    'text'
ans =
    'text'
ans =
    'line'
ans =
    'line'
ans =
    'line'
ans =
    'line'


The Matlab docs state that for each plotted item three objects (handles) will
be returned, i.e., a text object, line object and patch object.
Octave just returns the first two types, and with multiple plotted items the
order is different than in Matlab.

This makes for interesting confusion to get code that does post-processing on
legends running in both Matlab and Octave.





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?60792>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]