bugGNU Octave - Bugs: bug #58494, [Feature Request] graphics handles...


bug #58494: [Feature Request] graphics handles should support classdef dot syntax for accessing properties

Submitter:  Hartmut <hardy>
Submitted:  Wed 03 Jun 2020 06:58:02 PM UTC
Category:  Plotting Severity:  3 - Normal
Priority:  3 - Low Item Group:  Feature Request
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Thu 04 Jun 2020 09:13:50 PM UTC, comment #4: 

A few month ago, I have written the attached base class (graphics_placeholder) and a script to generate children class. If you want to get a feeling of how it could work with dot notation, unpack the attached archive, cd into the resulting folder and play:

## generate class files if necessary:
## dump_class_file ("__figure__", figure (), "__figure__.m");
## dump_class_file ("__axes__", axes (), "__axes__.m");
## ...
ax = __axes__ (gca);
ax.color = "r";

This is in no way something serious, just for dreaming and eventually testing performance.

(file #49214)

Pantxo Diribarne <pantxo>
Group Member
Thu 04 Jun 2020 05:00:59 PM UTC, comment #3: 

Matlab r2014a was the last release based on the traditional graphics system.
The new object-based graphics introduced with release r2014b broke quite a bit of existing code, so at my work we usually stay with r2014a. In addition we found that the object-based graphics is slower, but not extremely and maybe/probably our Matlab code hasn't been properly optimized for the new graphics stuff.
So an "internal" switch to classdef graphics may be HUGE as Rick correctly states, converting existing user code might also be quite an endeavour.

In spite of all this, I think that at some time Octave will have to bite the bullet. IMO the new graphics code is easier for users and fits in nicely with classdef.
The main objection I see is indeed the required amount of development work.

Philip Nienhuis <philipnienhuis>
Group Member
Wed 03 Jun 2020 10:44:06 PM UTC, comment #2: 

I think we should make it a low priority feature request for the HUGE switch to classdef for figures.

In the mean time, the old-style syntax of using get()/set() works in both Octave and Matlab for manipulating the properties of graphic handles.

h = figure ();
set (h, 'Name', 'My title');

Rik <rik5>
Group administrator
Wed 03 Jun 2020 07:47:26 PM UTC, comment #1: 

If I understand correctly, graphics handles in recent versions of Matlab have been changed to be classdef handle objects, not just numeric values that allow indexing into a database of graphics properties.

Octave's figure function does return a graphics handle (at least according to the older definition of graphics handle).  So I think we should close this report as invalid.

I suppose we could open a feature request for the (very large project) of "convert the graphics system to use classdef objects".

John W. Eaton <jwe>
Group administrator
Wed 03 Jun 2020 06:58:02 PM UTC, original submission:  

The following code works in Matlab (e.g. R2019b) but not in Octave (5.2.0):

h = figure
h.Name = 'My title'

I assume that the issue behind this is much broader. Currently Octave does not generate any "handle", that can be used lateron with this object oriented syntax.

This information doesn't sound new to me and might well be a duplicate issue, but I couldn't find any note on this when searching in Savannah bug reports.

Hartmut <hardy>


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

Attach Files:

Attached Files
file #49214:  bughg2.zip added by pantxo (11KiB - application/zip)


Depends on the following items: None found

   bug dependencies.


Carbon-Copy List
  • -email is unavailable- added by pantxo (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by hardy (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
    2022-10-19 mmuetzel Dependencies- bugs #63239 is dependent
    2020-06-04 pantxo Attached File- Added bughg2.zip, #49214
    2020-06-03 rik5 Priority5 - Normal 3 - Low
        Item GroupMatlab Compatibility Feature Request
        Release5.2.0 dev
        Summaryfigure() does not return a graphics handle [Feature Request] graphics handles should support classdef dot syntax for accessing properties

    Back to the top

    Powered by Savane 3.13-c54d.
    Corresponding source code