Orthographic projection instead of perspective for 3D plots?

Hello,

Is there a way to use orthographic instead of perspective projection for 3D plots?
This is in fact the standard for Matlab for example, and it is very convenient when viewing data to have a 2D projection when the camera is looking along one of the axis of the plot, for example.
Even if this requires some modification of plotly.js, I’d be interested to be guided in the right direction, even though a release is not done right away.

Best regards,
Emmanuel

2 Likes

There’s no way to change the projections settings in our 3D subplots at the moment.

Feel free to open a feature request -> https://github.com/plotly/plotly.js/issues/new

When doing so, make sure to add links to and screenshots of the relevant matlab examples you mentioned above.

Hi, is there any update in this regard? Thank you

@carlomontec
Orthographic projection has been introduced in 2019.
I paste here the layout definition from a json file to see how the projection type is set:

"layout": {"scene":{
                "camera": {
                    "projection": {
                        "type": "orthographic"
                    }
                  }}}
2 Likes

Thank you very much for the complete reply.

Am I the only one getting a perspective scene tile in the background even when choosing type=‘orthographic’?

It’s hard to convince oneself with toy data below, that this argument works as expected:

import plotly.graph_objs as go

fig = go.Figure()
scatter3d = fig.add_scatter3d(
    x=[0, 1, 2, 3],
    y=["A", "B", "C", "B"],
    z=[1, 3, 2, 1])
fig.layout.title.text = 'Perspective projection'
fig.show()

fig.layout.title.text = 'Orthographic projection'
fig.layout.scene.camera.projection.type = "orthographic"
fig.show()

adapted from: https://github.com/jonmmease/plotly.py_release_notebooks/blob/master/notebooks/v3.7.0/orthographic_projection.ipynb

Hi, I think you are looking for camera controls:

Which is different to the projection type.

EDIT: I created a dash app for trial & error of camera adjustments, maybe interesting for someone searching for this topic.

Oh thank you. I was rather trying to convince myself that the orthographic view is really orthographic.