我有一个像这样的 3D 散点图:
import numpy as np
from matplotlib import pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
x = np.random.random(10)
y = np.random.random(10)
z = np.random.random(10)
rgba = np.random.random((10, 4))
fig = plt.figure()
ax = fig.gca(projection='3d')
artist = ax.scatter(x, y, z, c=rgba)
如此处所示,我可以使用属性从散点图中检索 和 数据x
:y
z
artist
_offsets3d
x2, y2, z2 = artist._offsets3d
print(all(x == x2)) # True
print(all(y == y2)) # True
print(all(z == z2)) # True
我寻求一种类似的方式rgba
从artist
. 我实际上只需要 alpha 值,但我猜颜色和 alpha 仍然存储在一起。
如果重要,我会使用 matplotlib 3.0.0。