bugGNU Octave - Bugs: bug #44096, plotboxaspectratio wrong value for...

 
 

bug #44096: plotboxaspectratio wrong value for "axis equal"

Submitter:  Avinoam Kalma <avinoam>
Submitted:  Mon 26 Jan 2015 10:10:04 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Need Info Assigned to:  None
Originator Name:  Avinoam Open/Closed:  * Closed
Release:  * 3.8.2 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 28 Jan 2015 01:33:08 AM UTC, comment #3: 

Please avoid quoting from Matlab sources.  They own the copyright to their work and we must avoid, even accidentally, putting any non-GPL licensed code in to Octave.

I don't think we need to do anything in this case.  The exact ratio is 1.2679 but 1.25 looks good enough to the eye.  And for 2-D plots the Z-value of plotboxaspectratio doesn't matter.

I'm going to close the report for now, but it can be re-opened if a problem turns up.


Rik <rik5>
Group administrator
Tue 27 Jan 2015 09:56:57 PM UTC, comment #2: 

You are right.
Using Matlab R2010a, I get


plot (1:10)
axis equal
get (gca,'plotboxaspectratio')
   520.8000  410.7600   91.2800


which is not [3 4 4], neither [5 4 4].
Debugging Matlab code, shows in axis.m that plotboxaspectratio is computed in the following way:

dx = diff(get(gca,'xlim'));
dy = diff(get(gca,'ylim'));
dz = diff(get(gca,'zlim'));

set(gca,'Units','Pixels');
a = get (gca,'position');

b = [a(3)  a(4) dz*min(a(3),a(4))/min(dx,dy)]
b =
  520.8000  410.7600   91.2800


and plotboxaspectratio is set bo b.
If you run this in octave you will get a different answer:


b =
    434.000   342.300    34.230


because dx,dy,dz are different.

What do you recommend to do now?

Avinoam Kalma <avinoam>
Group Member
Mon 26 Jan 2015 11:23:34 PM UTC, comment #1: 

Do you have access to Matlab to test what the actual value is?  Matlab's documentation is occasionally wrong, and [3 4 4] will produce a plot that is taller (Y) than it is wide (X) which is not what I see in a sample plot.

Tets code:


plot (1:10)
axis equal
get (gca, 'plotboxaspectratio')


Rik <rik5>
Group administrator
Mon 26 Jan 2015 10:10:04 PM UTC, original submission:  


in axis.m, line 204 handles the case of "axis equal"


      set (ca, "dataaspectratio", [1, 1, 1], "plotboxaspectratio", [5 4 4]);


in Matlab documentation plotboxaspectratio get value of [3 4 4] for
"axis equal"

Avinoam Kalma <avinoam>
Group Member

 

(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 avinoam (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
    2015-01-28 rik5 Open/ClosedOpen Closed
    2015-01-26 rik5 StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code