matplotlib 3d表面上的连续色调

时间:2013-02-19 16:53:45

标签: matplotlib 3d

在matplotlib 3D绘图中,我可以设置确定表面上可见面部总数的行数/列数

s=ax.plot_surface(x,y,z, color='gray', shade=True, rstride=1,cstride=1)

其中较低的是数字rstride和cstride,面数越小。由于我也在这个表面上绘制流线/轨迹,我想摆脱脸的边缘。现在,用

s.set_linewidth(0)

设置较低的rstride和cstride值我几乎可以得到我想要的,即表面上几乎连续变化的颜色,可以提供良好的3D效果。

不幸的是,线条留在那里,因为面孔之间是空的。有没有办法做到这一点?也许我只是错过了一个简单的命令..

编辑:生成曲面的代码很长,无法在此处报告。我附上了上面写的解决方法的结果快照。surface with white lines

1 个答案:

答案 0 :(得分:9)

您是否尝试在其中添加antialiased=False

surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1)

enter image description here

surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, linewidth=0)

enter image description here

surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, linewidth=0, antialiased=False)

enter image description here