bugGNU Octave - Bugs: bug #57040, contour does not merge axes...

 
 

bug #57040: contour does not merge axes domains, if hold

Submitter:  Muhali <muhali>
Submitted:  Fri 11 Oct 2019 10:22:41 AM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * 5.1.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 11 Oct 2019 03:03:53 PM UTC, comment #4: 

This info seems to be stored in the hidden "XLimSpec" (or similar for y and z) property of the axes.
In Matlab R2016a:

>> figure;
>> axes;
>> get(gca, 'XLimSpec')

ans =

stretch

>> axis tight
>> get(gca, 'XLimSpec')

ans =

tight

>> set(gca, 'XLimSpec')
    'stretch'
    'tight'


Markus Mützel <mmuetzel>
Group administrator
Fri 11 Oct 2019 01:01:05 PM UTC, comment #3: 

@jwe: I tested online and both return the same. My main concern, is that ML is somewhat able to keep track of requested limits being "auto" or "tight". The following returns two different results:


clf; plot (1:10); hold on; axis tight; plot ([0 12.4]); get (gca, {'xlim', 'ylim'})
%%-> {[1 10], [0 12.4]}
clf; plot (1:10); hold on; plot ([0 12.4]); get (gca, {'xlim', 'ylim'})
%%-> {[1 10], [0 14]}


This means that even though "axis tight" was called before the appearance of the new 12.4 data, ML is still able to maintains tight limits automatically while the "x/ylimmode" are "manual" due to the call to axis.

Pantxo Diribarne <pantxo>
Group Member
Fri 11 Oct 2019 12:09:27 PM UTC, comment #2: 

What version of Matlab?  I find it strange that calling contour causes the axis limit modes to be set to manual.

I see a comment in the _contour_.m function that indicates that the reason for setting the axis modes was to avoid computing axis limits repeatedly as patches are added.  But now I'm wondering if we are doing this job incorrectly and should instead only be computing axis limits when rendering the axes or if explicitly requested.  For example, do the the following different in Matlab?  Note that these commands must be executed all on one line or in a script to avoid an implicit drawnow action when a command prompt is displayed.


clf; plot ([0, 10], [0, 10]); get (gca, {'xlim', 'ylim'})



clf; plot ([0, 10], [0, 10]); drawnow; get (gca, {'xlim', 'ylim'})


Only computing axis limits when rendering or when requested would improve efficiency generally and avoid the need for the kind of special code that attempts to defer computation of limits like we currently have in _contour_.m.



John W. Eaton <jwe>
Group administrator
Fri 11 Oct 2019 11:17:17 AM UTC, comment #1: 

Confirmed. Both ML and Octave have the x/ylimmode set "manual" after the call to contour, but Octave sets limits wrong. The workaround is to finally call "axis tight" which will lead to the same result as in ML.

Pantxo Diribarne <pantxo>
Group Member
Fri 11 Oct 2019 10:22:41 AM UTC, original submission:  

In this example


clf ; hold on
plot([0 10], [0 10])
[x, y, z] = peaks (50);
contour (x, y, z, -7:9);


the axes are scaled to [-3 3], clipping the upper part of the line. The correct behavior would be to merge the x– and y–domains, as done in Matlab.

Muhali <muhali>

 

(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 mmuetzel (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by muhali (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-10-11 pantxo StatusNone Confirmed
        Operating SystemGNU/Linux Any

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code