Black Lives Matter. Please consider donating to Black Girls Code today.

I want to rotate 3D Surface Plot at the same time

I am always grateful for your help.
I am making a 3D Surface Plots.
Is it possible to rotate two of the graph at the same time?
Please tell me how to make.

Here’s how:

1 Like

Thank you immediately answer!!
I am very helpful!!
By the way, I’d like the 3D Surface Plot is rotated at the same time with the mouse. (XYZ direction)
I am sorry. I was insufficient explanation.
Is this possible?

It should be doable.

Try attaching a mousemove handler to the plotly gl <canvas> and then calling a function similar to rotate() in the above codepen.

So, something like:

var d3 = Plotly.d3;'#graph').select('canvas #scene').on('mousemove', function() {
  // in pseudo-code
  var camera = scene.getCamera();

}):'#graph').select('canvas #scene2').on('mousemove', function() {
  // in pseudo-code
  var camera2 = scene2.getCamera();


I will thank you for your kindness.
I was able to successfully implement.
If there is the next challenge, please tell me.
Thank you very much!!

This helped me, too, thanks!

I would want to add that using atan2(y,x) instead of atan(y/x) makes the plot turn the full 360 degrees instead of just 180:

Hope this can be of help for someone with the same problem.