plotly / plotly/plotly.py

Orthographic projection prevents scene camera updates

Open
#2,474 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug P3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

(Plotting offline)

Setting the projection to orthographic seems to prevent scene_camera settings being applied. This creates difficulty in saving as non-png images that aren't the default view.

from random import random
from plotly import __version__
import plotly.graph_objects as go

print('version: ', __version__)

version: 4.7.1

x = [random() for each in range(100)]
y = [random()*0.3 for each in range(100)]
z = [random()*0.05 for each in range(100)]

fig = go.Figure()
fig.add_trace(go.Scatter3d(x=x, y=y, z=z))
fig.layout.scene.camera.projection.type = "orthographic"
fig.show()

image

fig.update_layout(scene_camera=dict(eye=dict(x=5, y=5, z=5)))
fig.show()

image

fig.update_layout(scene_camera=dict(up=dict(x=0, y=0, z=-1)))
fig.show()

image

fig.update_layout(scene_camera=dict(center=dict(x=1, y=1, z=1)))
fig.show()

image
Also, the default view has the plot at a zoom level that crops part of the plot from view for long-shaped plots.

fig.update_layout(scene=dict(aspectmode='data'))
fig.show()

image
Scroll-zooming still works when plotted interactively.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided Python reproduction with Plotly 4.7.1 and compare the orthographic camera behavior after each scene_camera update. Trace the offline image-export path for 3D scenes, then add a regression test covering projection type and camera settings. Done means orthographic exports apply eye, up, and center settings and preserve the intended view.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.