plotly / plotly/plotly.py

Allow setting the camera "field of view"

Open
#4,005 1 comment 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

It doesn't seem possible to set the 3D camera field of view (fov).

(Re: my post to Stackoverflow.)

Looking at the source code, I see that:

In https://github.com/plotly/plotly.js/blob/master/src/plots/gl3d/scene.js, it uses glPlot3d.createScene and sets the options in proto.prepareOptions.

In https://github.com/gl-vis/gl-plot3d/blob/master/scene.js#L179, the allowed options include the field-of-view parameter fovy (field-of-view in the vertical direction), which defaults to Math.PI/4 (45 degrees).

For 3D graphics, a 45-degree vertical field-of-view typically gives an exaggerated perspective. It corresponds to about a 28mm camera lens.

It would be nice for plotly.graph_objects.layout.scene.Camera to include a fovy parameter (in radians).

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 with plotly.py's layout.scene.Camera definition and trace how camera options reach plotly.js. Read src/plots/gl3d/scene.js, especially proto.prepareOptions, and compare its options with gl-plot3d's scene.js around line 179. Done means the Python camera API accepts fovy in radians and passes it through to the 3D scene.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.