在matplotlib三维表面的连续色调 [英] continuous shades on matplotlib 3d surface

查看:383
本文介绍了在matplotlib三维表面的连续色调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个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..

编辑:code产生表面冗长在此报告。我附上结果的快照与上面写的解决办法。

the code that generates the surface is lengthy to report it here. I attach a snapshot of the result with the workaround written above.

推荐答案

您是否尝试过加入抗锯齿=假在那里呢?

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三维表面的连续色调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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