是否有任何模块可以帮助我制作这样的东西?
答案 0 :(得分:6)
喜欢this,比方说?
matplotlib 3D scatter plot http://matplotlib.sourceforge.net/_images/scatter3d_demo.png
matplotlib
examples gallery是一件很棒的事情。
从链接示例复制的代码。
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
def randrange(n, vmin, vmax):
return (vmax-vmin)*np.random.rand(n) + vmin
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
n = 100
for c, m, zl, zh in [('r', 'o', -50, -25), ('b', '^', -30, -5)]:
xs = randrange(n, 23, 32)
ys = randrange(n, 0, 100)
zs = randrange(n, zl, zh)
ax.scatter(xs, ys, zs, c=c, marker=m)
ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')
plt.show()
答案 1 :(得分:3)
改编自Cookbook
from numpy import *
import pylab as p
import mpl_toolkits.mplot3d.axes3d as p3
x=random.randn(100)
y=random.randn(100)
z=random.randn(100)
fig=p.figure()
ax = p3.Axes3D(fig)
ax.scatter3D(ravel(x),ravel(y),ravel(z))
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
p.show()
答案 2 :(得分:1)
我认为matplotlib应该可以做类似的事情。