From: <pki...@us...> - 2007-09-05 21:40:44
|
Revision: 3793 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3793&view=rev Author: pkienzle Date: 2007-09-05 14:40:41 -0700 (Wed, 05 Sep 2007) Log Message: ----------- Convert to numpy Modified Paths: -------------- trunk/matplotlib/examples/quadmesh_demo.py trunk/matplotlib/examples/simple3d.py Modified: trunk/matplotlib/examples/quadmesh_demo.py =================================================================== --- trunk/matplotlib/examples/quadmesh_demo.py 2007-09-05 19:38:27 UTC (rev 3792) +++ trunk/matplotlib/examples/quadmesh_demo.py 2007-09-05 21:40:41 UTC (rev 3793) @@ -4,23 +4,21 @@ with some restrictions. """ -from matplotlib.mlab import linspace, meshgrid -import matplotlib.numerix as nx +import numpy as nx from pylab import figure,show -import matplotlib.numerix.ma as ma from matplotlib import cm, colors n = 56 -x = linspace(-1.5,1.5,n) -X,Y = meshgrid(x,x); +x = nx.linspace(-1.5,1.5,n) +X,Y = nx.meshgrid(x,x); Qx = nx.cos(Y) - nx.cos(X) Qz = nx.sin(Y) + nx.sin(X) Qx = (Qx + 1.1) Z = nx.sqrt(X**2 + Y**2)/5; -Z = (Z - nx.mlab.amin(Z)) / (nx.mlab.amax(Z) - nx.mlab.amin(Z)) +Z = (Z - nx.amin(Z)) / (nx.amax(Z) - nx.amin(Z)) # The color array can include masked values: -Zm = ma.masked_where(nx.fabs(Qz) < 0.5*nx.mlab.amax(Qz), Z) +Zm = nx.ma.masked_where(nx.fabs(Qz) < 0.5*nx.amax(Qz), Z) fig = figure() Modified: trunk/matplotlib/examples/simple3d.py =================================================================== --- trunk/matplotlib/examples/simple3d.py 2007-09-05 19:38:27 UTC (rev 3792) +++ trunk/matplotlib/examples/simple3d.py 2007-09-05 21:40:41 UTC (rev 3793) @@ -1,11 +1,6 @@ #!/usr/bin/env python -import matplotlib -matplotlib.rcParams['numerix'] = 'numpy' -import numpy as np -from numpy import arange, cos, linspace, ones, pi, sin -import matplotlib.numerix as nx -from matplotlib.numerix import outerproduct +from numpy import arange, cos, linspace, ones, pi, sin, outer import pylab import matplotlib.axes3d as axes3d @@ -20,9 +15,9 @@ u = arange(0, 2*pi+(delta*2), delta*2) v = arange(0, pi+delta, delta) -x = outerproduct(cos(u),sin(v)) -y = outerproduct(sin(u),sin(v)) -z = outerproduct(ones(u.shape), cos(v)) +x = outer(cos(u),sin(v)) +y = outer(sin(u),sin(v)) +z = outer(ones(u.shape), cos(v)) #ax3d.plot_wireframe(x,y,z) surf = ax3d.plot_surface(x, y, z) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |