matplotlib 3d 表面上的连续阴影 [英] continuous shades on matplotlib 3d surface

查看:27
本文介绍了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)

这篇关于matplotlib 3d 表面上的连续阴影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆