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: http://codepen.io/etpinard/pen/WxrRoG

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;

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

  scene2.setCamera(camera);
}):

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

  scene.setCamera(camera2);
}):

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.