Jesse
Jesse

Reputation: 1672

Matplotlib-like Subplots in Mayavi?

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?

Upvotes: 6

Views: 2771

Answers (1)

mdurant
mdurant

Reputation: 28684

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.

Upvotes: 3

Related Questions