Search code examples
plotmaple

Linked rotation of 3D plots


I'm plotting three 3D vector fields in one row in Maple 14:

> with(plots);
> A := Array(1 .. 3):
> A[1] := fieldplot3d(...):
> A[2] := fieldplot3d(...):
> A[3] := fieldplot3d(...):
> display(A);
  Here are the three plots arranged like this: [plot1] [plot2] [plot3]

Now I can rotate each of them individually to explore the vector fields. Is it possible to link other two plots so they will rotate to the same orientation automatically? It will be fine if this will be possible only when rotating just one of them (leftmost, for example).

For example, in MatLab there is linkprop function that can link properties of two axes so changes in one of them (rotation, scale, range, etc.) will be applied to other one too.


Solution

  • I don't believe that this can be done in current Maple using either the usual left-click-drag on the 3D plots or by adjusting the three orientation boxes in the plot menubar (which appears at the GUI's top, when you left-click to place the cursor focus on any of the individual 3D plots).

    But you can set the plots in one or more Plot Components, and create three Sliders whose underlying Action code causes a redisplay. The three sliders could thus control the three orientation angles. This is not as pleasing as using the mouse cursor to rotate freehand. But at least it allows plots in several Plot Components (or, in your case an Array plot in a single Plot Component) to be rotated in unison.

    One convenient way to set up the above in Maple 17, if you are unfamiliar with programming embedded components, is to use its enhanced Explore command.

    In Maple 17 a simple example, which you might replace with calls to plots:-fieldplot, could be,

    A:=Array(1..3):
    A[1]:=plot3d(x^3*y,x=-10..10,y=-10..10):
    A[2]:=plot3d(sin(x)*y,x=-10..10,y=-10..10):
    A[3]:=plot3d(x*y^2,x=-10..10,y=-10..10):
    
    Explore(plots:-display(A,orientation=[theta,phi,psi]),
        parameters=[theta=-180..180,phi=-180..180,psi=-180..180]);
    

    In Maple 16 the Explore command does not support the above call, but the three Sliders and the Plot Component are not difficult to hook together to get the same effect of unified reorientation and redisplay.

    The above approach is not very memory efficient, as it entails recreation and communication of very many whole 3D plot structures from engine to GUI. That's in contrast to the kind of rotation obtained by freehand click-dragging of the mouse cursor over a 3D plot, which just involves the GUI alone and presumably just efficient OpenGL redisplay. Any kind of memory leak, even a small one for each passed 3D plot (as Maple 16's Standard GUI appears to have) and this approach could cause the Standard Java GUI to slowly consume memory and eventually grind to a halt.