Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

continuous shades on matplotlib 3d surface

Tags:

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)

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)

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..

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

like image 459
gg349 Avatar asked Feb 19 '13 16:02

gg349


1 Answers

Have you tried adding antialiased=False in there too?

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

like image 107
will Avatar answered Sep 22 '22 04:09

will