From: <ef...@us...> - 2007-07-20 19:17:16
|
Revision: 3597 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3597&view=rev Author: efiring Date: 2007-07-20 12:17:14 -0700 (Fri, 20 Jul 2007) Log Message: ----------- A few more changes in examples Modified Paths: -------------- trunk/matplotlib/examples/contour_demo.py trunk/matplotlib/examples/ellipse_demo.py trunk/matplotlib/examples/image_demo.py trunk/matplotlib/examples/simple3d_oo.py Modified: trunk/matplotlib/examples/contour_demo.py =================================================================== --- trunk/matplotlib/examples/contour_demo.py 2007-07-20 18:35:35 UTC (rev 3596) +++ trunk/matplotlib/examples/contour_demo.py 2007-07-20 19:17:14 UTC (rev 3597) @@ -97,5 +97,5 @@ CB.ax.set_position([ll, b+0.1*h, ww, h*0.8]) -savefig('contour_demo') +#savefig('contour_demo') show() Modified: trunk/matplotlib/examples/ellipse_demo.py =================================================================== --- trunk/matplotlib/examples/ellipse_demo.py 2007-07-20 18:35:35 UTC (rev 3596) +++ trunk/matplotlib/examples/ellipse_demo.py 2007-07-20 19:17:14 UTC (rev 3597) @@ -1,24 +1,23 @@ -from pylab import figure, show, nx -from matplotlib.patches import Ellipse -rand = nx.mlab.rand - -NUM = 250 - -ells = [Ellipse(xy=rand(2)*10, width=rand(), height=rand(), angle=rand()*360) - for i in xrange(NUM)] - -fig = figure() -ax = fig.add_subplot(111, aspect='equal') -for e in ells: - ax.add_artist(e) - e.set_clip_box(ax.bbox) - e.set_alpha(rand()) - e.set_facecolor(rand(3)) - -ax.set_xlim(0, 10) -ax.set_ylim(0, 10) - -fig.savefig('../figures/ellipse_demo.eps') -fig.savefig('../figures/ellipse_demo.png') - -show() +from pylab import figure, show, rand +from matplotlib.patches import Ellipse + +NUM = 250 + +ells = [Ellipse(xy=rand(2)*10, width=rand(), height=rand(), angle=rand()*360) + for i in xrange(NUM)] + +fig = figure() +ax = fig.add_subplot(111, aspect='equal') +for e in ells: + ax.add_artist(e) + e.set_clip_box(ax.bbox) + e.set_alpha(rand()) + e.set_facecolor(rand(3)) + +ax.set_xlim(0, 10) +ax.set_ylim(0, 10) + +#fig.savefig('ellipse_demo.eps') +#fig.savefig('ellipse_demo.png') + +show() Modified: trunk/matplotlib/examples/image_demo.py =================================================================== --- trunk/matplotlib/examples/image_demo.py 2007-07-20 18:35:35 UTC (rev 3596) +++ trunk/matplotlib/examples/image_demo.py 2007-07-20 19:17:14 UTC (rev 3597) @@ -11,6 +11,6 @@ im = imshow(Z, interpolation='bilinear', cmap=cm.gray, origin='lower', extent=[-3,3,-3,3]) -savefig('image_demo') +#savefig('image_demo') show() Modified: trunk/matplotlib/examples/simple3d_oo.py =================================================================== --- trunk/matplotlib/examples/simple3d_oo.py 2007-07-20 18:35:35 UTC (rev 3596) +++ trunk/matplotlib/examples/simple3d_oo.py 2007-07-20 19:17:14 UTC (rev 3597) @@ -2,12 +2,11 @@ import matplotlib matplotlib.use('WXAgg') -matplotlib.rcParams['numerix'] = 'numpy' from wx import * import matplotlib.axes3d import matplotlib.mlab -from matplotlib import numerix as nx +import numpy as npy from matplotlib.figure import Figure from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg, FigureManager, NavigationToolbar2WxAgg @@ -39,13 +38,14 @@ ax3d = matplotlib.axes3d.Axes3D(self.fig) plt = self.fig.axes.append(ax3d) - delta = nx.pi / 199.0 - u = nx.arange(0, 2*nx.pi+(delta*2), delta*2) - v = nx.arange(0, nx.pi+delta, delta) + delta = npy.pi / 199.0 + u = npy.arange(0, 2*npy.pi+(delta*2), delta*2) + v = npy.arange(0, npy.pi+delta, delta) - x=nx.outerproduct(nx.cos(u),nx.sin(v)) - y=nx.outerproduct(nx.sin(u),nx.sin(v)) - z=nx.outerproduct(nx.ones(nx.size(u)), nx.cos(v)) + x = npy.cos(u)[:,npy.newaxis] * npy.sin(v)[npy.newaxis,:] + y = npy.sin(u)[:,npy.newaxis] * npy.sin(v)[npy.newaxis,:] + z = npy.ones_like(u)[:,npy.newaxis] * npy.cos(v)[npy.newaxis,:] + # (there is probably a better way to calculate z) print x.shape, y.shape, z.shape #ax3d.plot_wireframe(x,y,z) @@ -55,7 +55,7 @@ ax3d.set_xlabel('X') ax3d.set_ylabel('Y') ax3d.set_zlabel('Z') - self.fig.savefig('globe') + #self.fig.savefig('globe') if __name__ == '__main__': app = PySimpleApp(0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |