Menu

[r4647]: / branches / transforms / examples / simple3d.py  Maximize  Restore  History

Download this file

32 lines (21 with data), 596 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
from numpy import arange, cos, linspace, ones, pi, sin, outer
import pylab
import matplotlib.axes3d as axes3d
fig = pylab.gcf()
ax3d = axes3d.Axes3D(fig)
plt = fig.axes.append(ax3d)
delta = pi / 199.0
u = arange(0, 2*pi+(delta*2), delta*2)
v = arange(0, pi+delta, delta)
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)
surf.set_array(linspace(0, 1.0, len(v)))
ax3d.set_xlabel('X')
ax3d.set_ylabel('Y')
ax3d.set_zlabel('Z')
pylab.show()
#pylab.savefig('simple3d.svg')
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.