2017-08-30 51 views
-1

我正在绘制一些数据,并且我想根据类别使用不同的颜色。我有3个类别,0,1和2.其中一个轴是这个类,但我也想给它着色。我做:Matplotlib - 禁用渐变?

fig = plt.figure(1, figsize=(12, 8)) 
plt.clf() 
ax = Axes3D(fig, rect=[0, 0, .95, 1], elev=48, azim=134)  

ax.set_xlabel("Assignee") 
ax.set_ylabel("Cluster") 
ax.set_zlabel("Time") 

ax.scatter(df.assigned_to, df.cluster, df.resolution_time, c=df.cluster, edgecolor='k') 
plt.show() 

然而,这仍然给我类别中的梯度:

enter image description here

我要确保在同一集群中的每个点得到相同的颜色怎么办,没有gradience ?

回答

0

像往常一样,它有助于阅读文档。三维scatter有一个参数

depthshade
是否要遮荫散射标记给予深度的外观。默认值为True。

您可以将其设置为False以摆脱阴影。

ax.scatter(... , depthshade=False)