Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Animations don't respect the scene's 'up' key

I think this is just a bug. When you set the camera’s up direction to be something other than (0, 0, 1), and add animations. The camera is going to move to the wrong position when you move to a different frame. I set the up direction to be (0, 0, -1) to rotate the plot. Here’s a simple example that recreates the issue: https://gist.github.com/lordlycastle/d384d0324eb0d0598b4cda2f5815f76d

Does anyone have any other ways to rotate the camera along the Z axis? When looking down, I want the (0, 0) for (x, y) to be in the top left corner, and X and Yaxis to be left-right and up-down respectively.

@lordlycastle The layout defined in your posted code is the layout for initial data. If you want to update the layout for each frame, then you have to insert a key layout in each dict frames[k], and set in
frames[k]['layout'] what is changed with respect to the initial layout.
To understand, I updated your code, here, to rotate the observer around the origin O(0, 0, 0), along a great semicircle on a sphere of center O and radius R.
I chose this example because I suppose that you intended to perform such a rotation ( “rotate the camera along the Z axis” is a non-mathematical formulation). If I’m wrong, you can define the frame layout according to your rule, following this model.

1 Like

@empet Sorry I was ambiguous in saying rotating about Z axis. What I meant was just rotate it once and keep it there. So below you see the plot where X axis is vertical, we’re looking at it from the top. I want to rotate it so it’s horizontal ie rotate it clockwise by 90 degrees and Y axis is vertical. The camera doesn’t move at all in animations. I tried adding the same eye and up keys for the scene in each frame. They are all equal to the initial layout values. But the plots still resets/moves to the wrong position after each animation.

Here is the updated code. Sorry I can’t upload to Jupyter, I’m at work and the proxy won’t allow it.
rotate-me

@lordlycastle From the presentation of your issue it seems that you are not familiar with viewing 3d objects in computer graphics.
Take a look here https://goo.gl/nzj73B for a more detailed and clear explanation of the the role of eye, up and center vectors.

Taking eye=dict(x=0, y=-0.1, z=1.75), up=dict(x=0, y=0, z=1) in the scene of the initial layout, and no layout key in frames you’ll see the axes as you explained in the last post. Try also the configuration eye=dict(x=0, y=-0.1, z=-1.75), up=dict(x=0, y=0, z=1) .

1 Like

Thanks! That solved it.