如何在matplotlib散点图中设置/获取符号边的脊?

时间:2012-08-09 11:15:11

标签: python matplotlib

我尝试了以下内容:

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

carr = np.array([[0,0,0,1],[0,0,1,1],[0,1,0,1]]) # RGBA color array
ax = plt.axes(projection='3d')
h = ax.scatter([1,2,3],[1,2,3],[1,2,3], c=carr)
h.set_edgecolor(carr) ## also tried h.set_edgecolor('none')
plt.draw()

但标记边缘颜色仍为黑色。

1 个答案:

答案 0 :(得分:1)

尝试将颜色指定为edgecolors kwarg到scatter。 (注意复数。)

E.g。

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

carr = np.array([[0,0,0,1],[0,0,1,1],[0,1,0,1]]) # RGBA color array
ax = plt.axes(projection='3d')
h = ax.scatter([1,2,3],[1,2,3],[1,2,3], c=carr, edgecolors=carr)
plt.show()

enter image description here