23

I want to draw 3D primitives like spheres, cylinders and planes (patches) in a 3D plot and I would like to be able to interactively rotate, translate and zoom the scene. I want to do that in Python. I'm use to use Matplotlib for 2d graphs but I never worked with 3D graphics with Python.

Any suggestions? Any link to tutorials? Any ideas?

Bart
  • 19,692
  • 7
  • 68
  • 77
dom_beau
  • 2,437
  • 3
  • 30
  • 59
  • Via some OpenGL bindings for Python perhaps? – Bart Oct 03 '12 at 12:14
  • Yes I though about OpenGL but I beleived it was to "basic" (i.e. I would have to start from the ground to define the viewer) and I wanted something more evoluated. For example drawing a patch in a 3D plot _a la Matlab_ would be a easier way... But I don't know. Maybe it doesn't exist for Python? – dom_beau Oct 03 '12 at 12:26
  • Why not use [mplot3d](http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html) included in matplotlib? – Dhara Oct 03 '12 at 12:29
  • http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html Seems you can do 3d plots using it – mrvux Oct 03 '12 at 12:29
  • 1
    mplot3d in matplotlib shows 3d data set ploting (like surface plot, mesh plot) but I don't see how to plot a patch (x,y,z vertices with triangle array). Maybe I'm wrong... – dom_beau Oct 03 '12 at 12:42

1 Answers1

14

If you're used to matplotlib, then mplot3d is probably a good option if it meets your requirements.

Alternatively there is VPython. This allows you greater freedom to create arbitrary objects and manipulate them, but, of course, more to learn.

deadly
  • 1,194
  • 14
  • 24