Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4964920
  • 博文数量: 1696
  • 博客积分: 10870
  • 博客等级: 上将
  • 技术积分: 18357
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-30 15:16
文章分类
文章存档

2017年(1)

2016年(1)

2015年(1)

2013年(1)

2012年(43)

2011年(17)

2010年(828)

2009年(568)

2008年(185)

2007年(51)

分类: Python/Ruby

2010-07-29 14:47:07

I recently needed to do some simple 3D plotting in python. The strongest choice as discussed on the web is , which is part of the Enthought Python distribution. However, I have a previous python distribution already installed (via scisoft) with all of my favorite packages updated to the latest and greatest versions (e.g. matplotlib, PyEphem, slalib for python, etc.). I wanted to install Mayavi into my existing pythong distribution. In theory this should have been straightforward as there are eggs (a python package zip-type file). However, no matter how hard I tried, I could not get Mayavi, and all its required software, installed properly. Part of this may have been that I was doing a local install without admin privileges.

After spending an entire day with Mayavi issues, just in my attempt to make a very simple 3D scatter plot, I ran across a much easier option. The latest edition of (0.99.1) comes with a toolkit called mplot3d. After looking over examples and , it took me about 5 minutes to download and install the latest matplotlib version and I was ready to go! Simple 3D figures are a snap to put together and you can interact in order to zoom and rotate around. The toolkit uses matplotlib on the backend, so if you are familiar with all of the plotting options there, then mplot3d follows on logically.

My plot from matplotlib.mplot3d

My plot from matplotlib.mplot3d

There are still a few bugs/features that I haven’t quite figured out. Most notably, in or plots, I can’t seem to set the rstride and cstride (row and column segment step sizes) to anything less than 1. But one of my favorite things about python is that I should be able to go into the source code for mplot3d and figure out what the issue is.

If you have experience with either Mayavi or mplot3d, let us know in the comments when you would need to use Mayavi over the simpler functionality of mplot3d or if you have run into other issues with either.

阅读(2467) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~