gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 19:14:18 26 4
gpt4 key购买 nike

我尝试了以下方法:

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()

但标记边缘颜色保持黑色。

最佳答案

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

例如

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

关于python - 如何在 matplotlib 散点图中设置/获取符号边缘的脊线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11882184/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com