bugGNU Octave - Bugs: bug #55634, 2-D plots should ignore z-argument...

 
 

bug #55634: 2-D plots should ignore z-argument of "plotboxaspectratio"

Submitter:  Rik <rik5>
Submitted:  Sun 03 Feb 2019 02:57:49 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  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

Sun 10 Feb 2019 05:31:15 PM UTC, comment #8: 

Awesome.  I dumped the demos and I don't see any differences, and the examples in this bug report work perfectly.

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Sun 10 Feb 2019 11:18:14 AM UTC, comment #7: 

I ran the dump_plot script with the change and when I noticed nothing failing, I pushed it here:
http://hg.savannah.gnu.org/hgweb/octave/rev/24e11ee4fe45

Marking as ready for test.

Markus Mützel <mmuetzel>
Group administrator
Sat 09 Feb 2019 11:27:02 AM UTC, comment #6: 

The attached patch should solve the problem on a more general level. It also doesn't introduce more special cases for 2d plots.

In my limited tests it didn't break anything obvious.

(file #46220)

Markus Mützel <mmuetzel>
Group administrator
Sat 09 Feb 2019 10:03:39 AM UTC, comment #5: 

There is probably a better way to deal with the 3d extents of 2d objects that would solve this more generally. I'll try to think about it and report back.

Markus Mützel <mmuetzel>
Group administrator
Sat 09 Feb 2019 12:25:54 AM UTC, comment #4: 

@Markus: I don't think there's a reason to wait on commiting the patch for 2-D plots.  Something still needs to be worked out for 3-D plots.

Rik <rik5>
Group administrator
Mon 04 Feb 2019 04:58:43 AM UTC, comment #3: 

Definitely an improvement.  I would say that this resloves the problem with 2-D aspect ratios.  But a problem still remains with 3-D aspect ratios.  Take the same code, but display the third dimension.


t = linspace (0, 2*pi, 100);
y = sin (t);
plot (t, y);
axis equal
view (3)
## This line causes plot to disappear
pbaspect ([1500 750 1])


If I check with the Z limits with zlim() I find [-1, 1].  The plot can be made to appear again if I set the Z limits to something smaller such as [-.002 +.002].  This appears to be what Matlab does.  If I set the limits with


zlim ([-1, 1])


in Matlab then the plot disappears there as well.

I think Matlab will adjust the limits of the data, as long as "zlimmode" is "auto", when "dataaspectratio" and "plotboxaspectratio" are adjusted.  My guess is that Octave does not do that.  Maybe there is another special exception going on, because it does update the X and Y limits when I enter the command


pbaspect ([1500 750 1])



Rik <rik5>
Group administrator
Sun 03 Feb 2019 08:38:19 PM UTC, comment #2: 

I think the attached patch improves the logic for aspect ratios and z limits in 2d plots.

(file #46173)

Markus Mützel <mmuetzel>
Group administrator
Sun 03 Feb 2019 05:47:42 PM UTC, comment #1: 

The axis limits in z-direction are not calculated correctly:

>> pbaspect ([1500 750 750])

>> get (gca, "zlim")
ans =

  -1.0708   2.0708

>> pbaspect ([1500 750 1])
>> get (gca, "zlim")
ans =

   0.49791   0.50209


In the second case (of the disappearing plot) the z-limits don't include 0.
Matlab sets these limits symmetrically to z=0 for 2d plots which seems to make more sense.

Markus Mützel <mmuetzel>
Group administrator
Sun 03 Feb 2019 02:57:49 PM UTC, original submission:  

The OpenGL renderer is incorrectly using the z-argument of "plotboxaspectratio" for 2-D drawings where it does not apply.

Sample code to reproduce:


t = linspace (0, 2*pi, 100);
y = sin (t);
plot (t, y);
axis equal
## This line causes plot to disappear
pbaspect ([1500 750 1])


The pbaspect command is merely calling for a 2:1 ratio.  The plot can be made to re-appear by ensuring that the Z-argument is of the same order of magnitude as the X and Y arguments.  Either of these work


pbaspect ([1500 750 750])
pbaspect ([2 1 1])




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 #46220:  bug55634_2D_plot_ratio_v2.patch added by mmuetzel (3KiB - application/octet-stream)
file #46173:  bug55634_2D_plot_ratio.patch added by mmuetzel (4KiB - application/octet-stream)

 

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 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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-02-10 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2019-02-10 mmuetzel StatusPatch Submitted Ready For Test
    2019-02-09 mmuetzel Attached File- Added bug55634_2D_plot_ratio_v2.patch, #46220
        StatusPatch Reviewed Patch Submitted
    2019-02-09 rik5 StatusConfirmed Patch Reviewed
    2019-02-03 mmuetzel Attached File- Added bug55634_2D_plot_ratio.patch, #46173

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code