matplotlib 3d 表面上的连续阴影
在 matplotlib 3D 图中,我可以设置行数/列数来确定表面上可见的面总数
In a matplotlib 3D plot, I can set the number of rows/columns that determines the total number of faces visible on the surface with
s=ax.plot_surface(x,y,z, color='gray', shade=True, rstride=1,cstride=1)
rstride 和 cstride 的数字越小,人脸就越小.由于我也在这个表面上绘制流线/轨迹,我想摆脱面部的边缘.现在,随着
where the lower are the numbers rstride and cstride, the smaller are the faces. Since I am also plotting streamlines/trajectories on this surface, I would like to get rid of the edges of the faces. Now, with
s.set_linewidth(0)
并设置低值 rstride 和 cstride 我几乎得到了我想要的,即表面上几乎连续变化的颜色,这提供了良好的 3D 效果.
and setting low values of rstride and cstride I almost get what I want, i.e. an almost continuous changing color on the surface, that gives a good 3D effect.
不幸的是,线条留在那里,作为面部之间的空位.有没有办法做到这一点?也许我只是缺少一个简单的命令..
Unfortunately, the lines stay there, as empty places between the faces. Is there a way to do this? Maybe I am just missing a simple command..
生成表面的代码很长,在这里报告.我附上上面写的解决方法的结果快照.
the code that generates the surface is lengthy to report it here. I attach a snapshot of the result with the workaround written above.
您是否也尝试在其中添加 antialiased=False
?
Have you tried adding antialiased=False
in there too?
surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1)
surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, linewidth=0)
surf = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, linewidth=0, antialiased=False)