6

What I'm looking to do is have a pair of 3D figures side by side. enter image description here

In matplotlib, I was able to create these subplots like so: ax1 = fig.add_subplot(121, projection='3d')

I'm trying to use Mayavi for my 3D plotting here, because it solves some other problems I'm having, but I can't seem to find a way to plot two figures side-by-side.

Is this even possible?

Jesse
  • 1,662
  • 3
  • 17
  • 18

1 Answers1

3

Every mayavi actor has position/origin/orientation attributes, which you can set to move them to different parts of the scene. You can also add multiple axes and tailor both the ranges over which they display and the labels output. Using a combination of these, you can solve your question; but no, I don't know of a simple "subplot" mechanism.

Other possible alternatives

  • mlab.screenshot() on separate scenes and combine them in a custom view.
  • use the canvas frontend inside your own screen widgets, with each side-by-side widget showing a different scene.
mdurant
  • 27,272
  • 5
  • 45
  • 74
  • I think if there is not a simple subplot mechanism then I'll just work with separate scene windows. Something I was hoping to be able to do with MayaVi was to be able to share view angle between the plots. Since the right figure is generated by interpolating the left, ideally rotating one would rotate the other so they can be compared to each other in realtime. Instead I'll do this all using saveimage and just have still shots of the comparison. Thanks for your help! – Jesse Aug 06 '14 at 19:02
  • You _could_ try adding the same objects to different scenes and see what happens... Good luck! – mdurant Aug 06 '14 at 19:22
  • If you try to go after the multiple scenes option, look at pysurfer (https://github.com/nipy/PySurfer_ which builds a GUI with multiple scenes. Unfortunately pysurfer is designed messily and the approach of building a GUI and doing anything other than using it for interactivity (ie, creating the scene and then printing out a script) suffers from some critical timing problems. – aestrivex Aug 06 '14 at 20:37