bugGNU Octave - Bugs: bug #60897, caxis affected by rectangle and...

 
 

bug #60897: caxis affected by rectangle and patch graphic without scaled color

Submitted by:  Ryan Gray <ryangray>
Submitted on:  Fri 09 Jul 2021 06:21:56 AM UTC  
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  6.2.0 Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 20 Jul 2021 09:44:12 PM UTC, comment #2: 

comment #1:

> ... The logic that autoscales the "clim" property of an axis has to look at the color data for each relevant object.  My guess is that empty cdata, '[]', is being equated with 0 rather than having a special case to simply ignore.


That's my guess as well. However, given that reasserting the empty cdata fixes it, I think the check is there, but the bug is that the check is getting skipped when the patch object is first created.

Ryan Gray <ryangray>
Thu 15 Jul 2021 10:53:15 PM UTC, comment #1: 

Confirmed.

I tested on Linux and the same issue is present so I changed the OS to "Any".

The rectangle object in Octave is not a drew graphics primitive, but instead is mimicked with a patch object.  See the file rectangle.m.

Hence, you are correct that this is a general issue related to patches.  The logic that autoscales the "clim" property of an axis has to look at the color data for each relevant object.  My guess is that empty cdata, '[]', is being equated with 0 rather than having a special case to simply ignore.

Rik <rik5>
Project Administrator
Fri 09 Jul 2021 06:21:56 AM UTC, original submission:  

In Octave 6.1 and 6.2, adding a rectangle graphic to an imagesc plot, the caxis limits are affected. In Octave 5.2, the limits are unaffected as it is in MATLAB. I have not found anything that mentions this as an intentional change. I have tested this on Windows.

>> figure; imagesc(rand(16)+1);
>> caxis

ans =

   1.0020   1.9928

>> hold on; rectangle('position',[4 4 4 4]);
>> caxis
ans =

        0   1.9928

I would expect the lower value to still be 1.0020.

Adding a patch graphic that doesn't use scaled color also affects the caxis when it shouldn't.

>> figure; imagesc(rand(16)+1);
>> hold on; p = patch([1 4 4]',[1 1 4],'w','edgecolor','c');
>> caxis
ans =

        0   1.9996

Interestingly, if we re-assert the cdata property as empty, it corrects the caxis:

>> get(p,'cdata')
ans = [](0x0)
>> set(p,'cdata',[])
>> caxis
ans =

   1.0003   1.9996

If the rectangle is being drawn with a patch, it's likely why the rectangle has the same problem.

Ryan Gray <ryangray>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

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 ryangray (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-07-15 rik5 StatusNone => Confirmed
        Operating SystemMicrosoft Windows => Any

    Back to the top


    Powered by Savane 3.6