1

我想创建一个 3D 散点图。还有第四个参数,它将由彩色图指示。我可以用 Python 和 IDL 编程,但想知道是否有人创建了这样的散点图,最好使用什么工具?

谢谢。

4

1 回答 1

2

There are two main options matplotlib and Mayavi. At the moment matplotlib is more popular, so you will find info easier. Mayavi tends to be more advanced so you would use it if matplotlib is not enough for your use case(for example too slow). An example using matplotlib:

import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
n = 100

xs = np.random.randint(0, 10, size=n)
ys = np.random.randint(0, 10, size=n)
zs = np.random.randint(0, 10, size=n)
colors = np.random.randint(0, 10, size=n)
ax.scatter(xs, ys, zs, c=colors, marker='o')
plt.show()

enter image description here

You can find more examples here.

于 2013-09-12T00:57:49.657 回答