[matplotlib-devel] Python 3D plotting
Hi, I've developed a simple 3D plotting module which u can find at http://www.scipy.org/WilnaDuToit . There's still alot of work to be done, so please feel free to play/use/extend/break it if u find it useful and send comments/enquiries/fixes etc to [EMAIL PROTECTED] Hope someone can use it :) Wilna du Toit - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Python 3D plotting
Interesting ! The lack of proper 3D plotting in scipy is a major problem in my eyes. I would like to point out tvtk ( http://scipy.org/Cookbook/MayaVi/tvtk) that is a great framework for developing 3D plotting tools in python. One example is the new version of the famous Mayavi, but something "command line driven", like pylab, can be easily implemented, as the mlab module ( http://scipy.org/Cookbook/MayaVi/mlab ) demonstrates. These rely on the ETS (enthought tool suite) which is currently a very haevy dependency if you are not using the enthought python distribution, but enthought is working on repackaging this as eggs. I think that using tvtk as a backend will allow faster development than raw OpenGL, and code reuse with Mayavi2 and Co. A lot of very well thought work has gone in tvtk and it needs little work to come out as a useful plotting package. I coded such a package in a quick and dirty way for myself and have always wanted to find the time to polish it and propose its integration to tvtk. I send it as an example of what one can do in an afternoon with tvtk. (see https://mail.enthought.com/pipermail/enthought-dev/2006-July/002140.html for a discussion of this module) Best regards, Gaƫl import os os.environ['NUMERIX'] = 'numpy' from scipy import arange, ravel, amax, amin, zeros, column_stack, sqrt, ones from enthought.tvtk.tools import mlab class figure3d: """ A window for displaying 3D objects """ title = '' xlabel = 'x' ylabel = 'y' zlabel = 'z' objects = [] background = (1.0,1.0,1.0) foreground = (0.0,0.0,0.0) fig = None def update(self): """Updates the figure""" if self.fig: hasTitle=0 # Update the title for object in self.fig.objects: if str(type(object))=="": object.text = self.title object.text_actor.property.color=self.foreground hasTitle=1 if not self.title == '' and not hasTitle: t=mlab.Title() t.text=self.title t.text_actor.property.color=self.foreground self.fig.add(t) # Update the labels self.fig.objects[0].axis.x_label=self.xlabel self.fig.objects[0].axis.y_label=self.ylabel self.fig.objects[0].axis.z_label=self.zlabel # Update the colors self.fig.renwin.background=self.background for object in self.fig.objects[0].actors: object.property.color=self.foreground self.fig.renwin.render() def show(self): """ Shows the figure, if not already displayed """ if not self.fig: self.fig = mlab.figure(browser=False) self.fig.renwin.x_plus_view() self.fig.renwin.camera.azimuth(-62) self.fig.renwin.camera.elevation(19.5) self.update() def surf(self,z, transparency=0.0, transparent=0): """ Plot a 3d surface from a 2D array """ y=arange(0,z.shape[0]) x=arange(0,z.shape[1]) # Flatten the matrix z=ravel(z) Zmax=amax(z)-amin(z) XYmax=amax((amax(y)-amin(y),amax(x)-amin(y))) Zscale=XYmax/float(Zmax)*0.5 s=mlab.SurfRegular(x,y,z,scale=[1.0,1.0,Zscale]) s.scalar_bar.title='' s.show_scalar_bar=True s.scalar_bar.orientation="horizontal" s.scalar_bar.property.color=self.foreground # LUT means "Look-Up Table", it give the mapping between scalar value and # color s.lut_type='blue-red' transparency=1.0-transparency s.lut.alpha=transparency s.lut.alpha_range=(transparency,transparency) if transparent: s.lut.alpha_range=(0.0,1.0) if not self.fig: self.show() # Scale properly the box outline self.fig.objects[0].axis.set_ranges((amin(x),amax(x),amin(y),amax(y),amin(z),amax(z))) self.fig.objects[0].axis.use_ranges=1 self.fig.add(s) def plot3(self, x, y, z, color=(0,0.5,1.0), linewidth=1): """ Plot a 3D line from 3 sets of coordinates """ assert len(x)== len(y) and len(y)==len(z), "x,y,z must have same number of coordinates" x=ravel(x) y=ravel(y) z=ravel(z) size=max((amax(x)-amin(x),amax(y)-amin(y),amax(z)-amin(z))) pts = zeros((len(x), 3), 'd') pts[:,0], pts[:,1], pts[:,2] = x, y, z linewidth=0.05*linewidth/size l = mlab.Line3(pts,color=color, radius=linewidth) if not self.fig: self.show() self.fig.add(l) def edit_traits(self): self.fig.edit_traits() def quiver3d(self, x, y, z, vx, vy, vz, scalars=None, color=None, autoscale=1): """ Displays a plot of arrows located at x, y, z, and of coordinates vx, vy, vz""" assert len(x) == len(y) and len(y) == len(z)
Re: [matplotlib-devel] [Matplotlib-users] ANN: matplotlib-0.87.5 *fixed*
Hey Charlie, I totally appreciate the effort you put into making these releases, particularly on Windows, where I must admit, I have a faint heart... But I found a couple issues (neither require a re-release, but just to be aware of them next time): 1) there are several .pyc files left in the .tar.gz release 2) the setup.cfg file in the release specifies, in the egg_info section, "tag_svn_revision = 1", which makes any further attempts to do python setup.py sdist with setuptools result in a package versioned matplotlib-0.87.5-r0, which isn't right. (Basically, this setup.cfg file is telling setuptools that this is a development version and it should tag the svn version. Not being in a subversion tree, it finds the version as 0.) I made a note a few weeks ago in the DEVNOTES file (section "making a release") to remove the setup.cfg file, or at least this section, prior to making a release. Cheers! Andrew Charlie Moad wrote: > Sorry all for the error. I just uploaded "working" (at least for me) > versions to sourceforge again. For those who are sicking of playing > with mirrors here is a direct download. Don't expect this link to be > good for a long time though. > > http://euclid.uits.iupui.edu/mplfiles/ > > - Charlie > > On 9/6/06, Charlie Moad <[EMAIL PROTECTED]> wrote: > >> The source error must of propagated to those builds. I will post new >> ones shortly. >> >> On 9/6/06, Sven Schreiber <[EMAIL PROTECTED]> wrote: >> >>> Well the thread on the devel list that I referred to explicitly has the >>> win32 exe in its title ("Missing __init__.py in >>> matplotlib-0.87.5.win32-py2.4.exe ?") . The starting post there pretty >>> much says it all. >>> >>> There's also a recent post on the numpy list that sounds like it's maybe >>> the same problem (quote): >>> """ >>> Is there a compatible matplotlib as well? I was o.k. with mpl from >>> enthought until I switched numerix to numpy. That made mpl unhappy. >>> I downloaded 0.87.5 but I broke something in the process because now >>> even switching back to Numeric doesn't make mpl happy. >>> """ >>> >>> Thanks, >>> Sven >>> >>> Charlie Moad schrieb: >>> That error was relating to the source release. Can you please post your error for the binary? On 9/6/06, Sven Schreiber <[EMAIL PROTECTED]> wrote: > Charlie Moad schrieb: > >> Minor rev bump for numpy 1.0b5 compatibility. This release should >> remain compatible with future 1.0 releases of numpy. >> >> > I keep running into the ImportError problem described on the devel list, > with the win32 2.4 binary (exe). Is that still just a case of waiting > for the mirrors to update, or is there a deeper problem? Are there > alternative download links? How to tell whether it's the "right" binary, > since version numbers are the same? > > Thanks for your help, > Sven > > >>> > > - > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > ___ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] [Matplotlib-users] ANN: matplotlib-0.87.5 *fixed*
Andrew Straw wrote: > 1) there are several .pyc files left in the .tar.gz release > 2) the setup.cfg file in the release specifies, in the egg_info section, > "tag_svn_revision = 1", which makes any further attempts to do python > setup.py sdist with setuptools result in a package versioned > matplotlib-0.87.5-r0, which isn't right. (Basically, this setup.cfg file > is telling setuptools that this is a development version and it should > tag the svn version. Not being in a subversion tree, it finds the > version as 0.) I made a note a few weeks ago in the DEVNOTES file > (section "making a release") to remove the setup.cfg file, or at least > this section, prior to making a release. > 3) in lib/matplotlib.egg-info/PKG-INFO, the version is specified as 0.87.5-r2761 Issues 2 and 3 appear to stem from matplotlib attempting to use setuptools for those who would, but not requiring it. I think the cleanest solution would be to make the actual sdist release using setuptools -- this should bring these issues into the open rather than lurking for someone like me to find them. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] [Matplotlib-users] ANN: matplotlib-0.87.5 *fixed*
On 9/7/06, Andrew Straw <[EMAIL PROTECTED]> wrote: > Hey Charlie, I totally appreciate the effort you put into making these > releases, particularly on Windows, where I must admit, I have a faint > heart... > > But I found a couple issues (neither require a re-release, but just to > be aware of them next time): > > 1) there are several .pyc files left in the .tar.gz release > 2) the setup.cfg file in the release specifies, in the egg_info section, > "tag_svn_revision = 1", which makes any further attempts to do python > setup.py sdist with setuptools result in a package versioned > matplotlib-0.87.5-r0, which isn't right. (Basically, this setup.cfg file > is telling setuptools that this is a development version and it should > tag the svn version. Not being in a subversion tree, it finds the > version as 0.) I made a note a few weeks ago in the DEVNOTES file > (section "making a release") to remove the setup.cfg file, or at least > this section, prior to making a release. I agree with all your points and will look out for them in the future. I typically build the sdist without setuptools, but I guess some lingering files are getting included. - Charlie - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel