bugGNU Octave - Bugs: bug #44323, Zooming in 3D plots works on XY...


bug #44323: Zooming in 3D plots works on XY plane rather than projection plane

Submitter:  Philip Nienhuis <philipnienhuis>
Submitted:  Fri 20 Feb 2015 12:42:03 PM UTC
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Confirmed Assigned to:  None
Originator Name:  Philip Nienhuis Open/Closed:  * Open
Release:  * dev Operating System:  * Any
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


( Jump to the original submission )

Sun 03 Mar 2019 10:01:09 PM UTC, comment #8: 

@Philip: The distortion is due to Octave's approach for zooming 3D scenes, which is changing xlim and ylim just like in 2D. This approach leaves zlim unchanged, hence the flattened surfaces when zooming in.

Matlab behaves differently for 3D scenes. Instead of changing the axes limits they seem to change the view angle. I guess they also change the camera target when using the mouse to zoom around a specific region.

Pantxo Diribarne <pantxo>
Project Member
Sun 03 Mar 2019 09:05:20 PM UTC, comment #7: 

I never used the camzoom, so take the following but a grain of salt.

By just experimenting (e.g., camzoom(2) ) it seems to work.

But when first zooming in using the "+ " (zoom-in) button and then zooming in further, the 3D plot keeps being distorted. I think this distortion should be avoided in the first place, maybe (blind guess!) by e.g., locking the appropriate aspectratio propertie(s) when zooming.

Philip Nienhuis <philipnienhuis>
Project Member
Sun 03 Mar 2019 07:09:16 PM UTC, comment #6: 

@Philip: Can the ML behavior be achieved using camzoom/va? IOW does zooming a 3D plot change the axes "camera*" properties?

Pantxo Diribarne <pantxo>
Project Member
Fri 23 Dec 2016 07:04:18 PM UTC, comment #5: 

This behavior is still present in Octave 4.2.0.

Hartmut <hardy>
Thu 12 Mar 2015 06:03:24 PM UTC, comment #4: 

@Philip: I agree with your comment #2.  It is visually more appealing if all three axes--x, y, and z-- are changed together so that 3-D objects are not distorted on zooming.

It's very easy to see the issues with the following code:

# zoom out with mouse, sphere changes shape into an ellipsoid.

Rik <rik5>
Project Administrator
Mon 02 Mar 2015 10:35:34 PM UTC, comment #3: 

FTR, I've attached a pic of what ML does when zooming in and out:
it leaves the XYZ axes limits untouched, it only zooms in/out on the picture itself. It does clip axes limits to the graph window borders.

Whether that is what we want for zooming out, I'm not sure; I see little use for just a very small graph in a relatively large plot window.
I'd rather have the axis limits be adapted isomorphously, ~ like Octave does but for all 3 axes.

Philip Nienhuis <philipnienhuis>
Project Member
Mon 02 Mar 2015 10:20:13 PM UTC, comment #2: 

I'm sorry I wasn't clear enough. I'll try again.

With "projection plane" I mean this: any 3D-object is obviously projected to a 2D plane when drawn on a screen.

I've attached 3 pics of the command
plot3 ([0 1], [0 1], [0 1], "r", "linewidth", 3)

In the first all three axes (XYZ) extend from 0-1.
In the second (zoomed out) plot, only the X- and Y-axes have been zoomed out (larger range limits), the Z-axis limits are still [0 1].
Same goes for the 3rd pic (zoomed in), where the X_ and Y-axis are zoomed in but the Z-axis limits again remain to be [0 1].

It may be even easier to simply zoom out on the 3D-plot made by the sombrero command. The plot will be stretched in the Z-direction, as the Z-axis limits remain to be [0 1].

My conclusion is that zooming in and out only works on the X and Y axes, but ignores the Z-axis.

As stated in the original report, Matlab zooms in/out on all 3 axes for 3D graphs.

I think this ML-incompatible behavior has been there for a very long time.

Philip Nienhuis <philipnienhuis>
Project Member
Fri 27 Feb 2015 03:07:58 PM UTC, comment #1: 

I don't understand what you mean by "zooms in/out on the plane on which the rotated 3D-plot is projected".

I need a patch that does this job, or a detailed description of exactly what is supposed to happen.

John W. Eaton <jwe>
Project Administrator
Fri 20 Feb 2015 12:42:03 PM UTC, original submission:  

(Singling out this one from bug #44307)

Zooming in/out of (rotated) 3D plots works only on the XY plane. As a consequence the picture gets distorted in the Z-direction.

Matlab zooms in/out on the plane on which the rotated 3D-plot is projected, as I would expect.

It can easily be seen doing:

plot3 ([0 1], [2 3], [4 5]);

rotate the plot a little,

and zoom in/out.

Philip Nienhuis <philipnienhuis>
Project Member


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

Attach Files:

Attached Files
file #33233:  zoomoutML.png added by philipnienhuis (10KiB - image/png)
file #33234:  zoominML.png added by philipnienhuis (39KiB - image/png)
file #33230:  prezoom1.png added by philipnienhuis (13KiB - image/png)
file #33231:  zoomout1.png added by philipnienhuis (16KiB - image/png)
file #33232:  zoomin1.png added by philipnienhuis (17KiB - 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 pantxo (Posted a comment)
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by philipnienhuis (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 project members can vote.





    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-03-12 rik5 StatusNone Confirmed
    2015-03-02 philipnienhuis Attached File- Added zoomoutML.png, #33233
        Attached File- Added zoominML.png, #33234
    2015-03-02 philipnienhuis Attached File- Added prezoom1.png, #33230
        Attached File- Added zoomout1.png, #33231
        Attached File- Added zoomin1.png, #33232

    Back to the top

    Powered by Savane 3.9