bugGNU Octave - Bugs: bug #64266, "axis tight" does not...

 
 

bug #64266: "axis tight" does not work following "axis equal"

Submitter:  Rik <rik5>
Submitted:  Wed 31 May 2023 08:53:54 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Confirmed 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
   

Jump to the original submission

Wed 07 Jun 2023 05:16:04 PM UTC, comment #6: 

This is interesting.  According to Matlab documentation, if manual axis limits, data aspect ratio, and plotbox aspect ratio are all specified then  Matlab chooses to honor the first two (limits and data aspect ratio).  When all three are set in Octave it prioritizes data aspect ration and plot box ratio and sacrifices axis limits.

Rik <rik5>
Group administrator
Sun 04 Jun 2023 04:18:42 AM UTC, comment #5: 

A simpler example is


plot (1:0.5:5.5, 1:10, 'o-')
axis equal
axis tight


Rendering is wrong.  But what is worse is that directly setting limits does not work.  Trying


xlim ([1, 5.5])


set the "xlim" property correctly, but the plot pays no attention to this value.

Rik <rik5>
Group administrator
Fri 02 Jun 2023 04:05:11 PM UTC, comment #4: 

I checked axis.m in version 7.3 and it uses m-file code to find the minimum and maximum of the plotted data and then sets those limits.  On the development branch, this functionality has apparently been moved to C++ code.  The m-file code in axis.m is now


      elseif (strcmpi (opt, "tight"))
        ## sets the axis limits to the min and max of all data.
        set (ca, "xlimmode", "auto", "ylimmode", "auto", ...
                 "zlimmode", "auto", ...
                 "xlimitmethod", "tight", "ylimitmethod", "tight",
                 "zlimitmethod", "tight");


Rik <rik5>
Group administrator
Fri 02 Jun 2023 03:57:51 PM UTC, comment #3: 

7.3 also got it right.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Fri 02 Jun 2023 06:05:19 AM UTC, comment #2: 

This is a regression: I tested with Octave 6.4 and it works as expected.

Pantxo Diribarne <pantxo>
Group Member
Wed 31 May 2023 08:55:22 PM UTC, comment #1: 

Desired output (from Matlab) is shown below.



But, Octave output below does not do a tight ylimit.



Rik <rik5>
Group administrator
Wed 31 May 2023 08:53:54 PM UTC, original submission:  

Code to reproduce is shown below and attached as tst_axis_tight.m.


[X,Y] = meshgrid(-3:6/17:3);
XX = 2*X.*Y;
YY = X.^2 - Y.^2;
colorscale = [1:18; 18:-1:1];
C = repmat(colorscale,9,1);

pcolor(XX,YY,C);

axis equal
axis tight


Rik <rik5>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #54800:  octave.png added by rik5 (78KiB - image/png)
file #54801:  tst_axis_tight.m added by rik5 (159B - text/x-objcsrc)
file #54802:  matlab.png added by rik5 (78KiB - 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 dasergatskov (Posted a comment)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by rik5 (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-06-02 pantxo Item GroupIncorrect Result Regression
    2023-05-31 rik5 Attached File- Added octave.png, #54800
        Attached File- Added tst_axis_tight.m, #54801
        Attached File- Added matlab.png, #54802

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code