I'm trying to plot 3D graphs with plotly and need to adjust camer position. I found that there's two ways to do it: either with camera attribute of Scene object, or with cameraposition attribute. I have problem with both, but this question is related to cameraposition: I can't figure out what does it mean.
The docs says:
| cameraposition [required=False] (value=camera position list or 1d numpy
| array):
| Sets the camera position with respect to the scene. The first entry
| (a list or 1d numpy array of length 4) sets the angular position of
| the camera. The second entry (a list or 1d numpy array of length 3)
| sets the (x,y,z) translation of the camera. The third entry (a
| scalar) sets zoom of the camera.
|
| Examples:
| [[0.2, 0.5, 0.1, 0.2], [0.1, 0, -0.1], 3]
What 4 numbers of angular position of the camera mean? Are they angles? In radians? Which angles?
Here's an explanation of Plotly's camera controls for 3d plots:
http://nbviewer.jupyter.org/github/etpinard/plotly-misc-nbs/blob/master/3d-camera-controls.ipynb
For the sake of completeness, here is a short summary:
It is possible to use camera instead of cameraposition as it seems to have simpler explanation.
The camera position is determined by three vectors: up, center, eye.
The up vector determines the up direction on the page. The default is (x=0, y=0, z=1), that is, the z-axis points up.
The center vector determines the translation about the center of the scene. By default, there is no translation: the center vector is (x=0, y=0, z=0).
The eye vector determines the camera view point about the origin. The default is (x=1.25, y=1.25, z=1.25).
It is also possible to zooming in by reducing the norm the eye vector.
name = 'eye = (x:0.1, y:0.1, z:1)'
camera = dict(
up=dict(x=0, y=0, z=1),
center=dict(x=0, y=0, z=0),
eye=dict(x=0.1, y=0.1, z=1)
)
fig = make_fig(camera, name)
py.iplot(fig, validate=False, filename=name)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With