bugGNU Octave - Bugs: bug #60513, contour hggroup does not have...

 
 

bug #60513: contour hggroup does not have hidden "facecolor" property like Matlab

Submitter:  Nicholas Jankowski <nrjank>
Submitted:  Mon 03 May 2021 05:37:37 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Nicholas Jankowski Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 19 May 2021 07:28:09 PM UTC, comment #6: 

grabbed the modified _contour_.m and just verifying that the patch code now mimics matlab output:




Nicholas Jankowski <nrjank>
Group Member
Fri 14 May 2021 10:25:55 PM UTC, comment #5: 

The fix seems to have been as easy as just adding the FaceColor property to the contour group.  I made that change here http://hg.savannah.gnu.org/hgweb/octave/rev/df0f97c4fb18.  There were no new test failures with "make check" so I think this is fine.  Closing report.

Rik <rik5>
Group administrator
Tue 11 May 2021 03:23:15 AM UTC, comment #4: 

It changes the facecolor of the surface object, but not not the contour object below it.  It's the contour object which doesn't seem to implement the "FaceColor" property, although it supports setting/getting.

Try the code which isolates the contour object.


[X, Y] = meshgrid (linspace (-3, 3, 40));
Z = sqrt (abs (X .* Y)) ./ (1 + X.^2 + Y.^2);
[~, hc] = contour (X,Y,Z);
set (hc, 'facecolor', 'r');


Rik <rik5>
Group administrator
Tue 11 May 2021 03:16:49 AM UTC, comment #3: 

"Matlab seems to ignore setting the facecolor"

does it? in the example I gave setting the facecolor in meshc does change the facecolor of the underlying surface object.

the results of:


[X, Y] = meshgrid (linspace (-3, 3, 40));
Z = sqrt (abs (X .* Y)) ./ (1 + X.^2 + Y.^2);
A = meshc (X, Y, Z);
title ('no facecolor');
figure;
B = meshc (X, Y, Z, 'FaceColor', 'r');
title('with red facecolor');


attached showing the facecolor option does change the face color.  or maybe I'm misunderstanding what you mean?


Nicholas Jankowski <nrjank>
Group Member
Mon 10 May 2021 11:23:06 PM UTC, comment #2: 

This is just a weirdness of Matlab.  In Matlab, the contour plot is contained in a contour object.  The list of properties for that object is https://www.mathworks.com/help/matlab/ref/matlab.graphics.chart.primitive.contour-properties.html.

If you create such an object and then query it there is no 'FaceColor' property.


[X, Y] = meshgrid (linspace (-3, 3, 40));
Z = sqrt (abs (X .* Y)) ./ (1 + X.^2 + Y.^2);
[~, hc] = contour (X,Y,Z);
get (hc)


On the other hand, you can directly query the property with


get (hc, 'facecolor')


or set it with


set (hc, 'facecolor', 'r')


Matlab seems to ignore setting the facecolor, so maybe it is enough to just add a 'facecolor' property to Octave's contour hggroup which doesn't do anything.  That would be a 1-line addition of an addproperty() call in _contour_.m.

Rik <rik5>
Group administrator
Mon 03 May 2021 05:45:11 PM UTC, comment #1: 

the following does work:


A =  meshc (X, Y, Z);
set(A(1), 'FaceColor', 'r')


so the issue appears to just be with however meshc tries to set the property during creation.

Nicholas Jankowski <nrjank>
Group Member
Mon 03 May 2021 05:37:37 PM UTC, original submission:  



[X, Y] = meshgrid (linspace (-3, 3, 40));
Z = sqrt (abs (X .* Y)) ./ (1 + X.^2 + Y.^2);
A = meshc (X, Y, Z, 'FaceColor', 'r');


Matlab it plots as expected, and checking the underlying surface object:


>> A(1).FaceColor
ans =
     1     0     0


in Octave, the plot is produced and matches the matlab output, but the following error is received and the handle A is never created:


>> A =  meshc (X, Y, Z, 'FaceColor', 'r');
error: set: unknown hggroup property FaceColor
error: called from
    __contour__ at line 233 column 8
    meshc at line 101 column 16
>> A
error: 'A' undefined near line 1, column 1


Nicholas Jankowski <nrjank>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #51454:  octave_fixed.png added by nrjank (268KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by nrjank (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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-05-19 nrjank Attached File- Added octave_fixed.png, #51454
    2021-05-14 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2021-05-11 nrjank Attached File- Added facecolorcheck_matlab2021a.png, #51416
    2021-05-10 rik5 Item GroupUnexpected Error or Warning Matlab Compatibility
        StatusNone Confirmed
        Release6.2.0 dev
        Summarymeshc error applying property to hggroup when trying to apply property to underlying surface plot contour hggroup does not have hidden "facecolor" property like Matlab

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code