Skip to main content

plotting - How does one get Mesh lines at 0 in ParametricPlot3D?


The following is in the documentation (MMA 10) under ParametricPlot3D -> Options -> Mesh :


ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], 
Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}, Mesh -> 10]


You'll see that the lines for u=0 and for v=0 are missing. These can be restored by using Mesh->Full, but then the number of lines will be the default, 15. I'd also like to have the number of lines be different in the two directions, with each one containing 0, but Mesh->{Full,10}, e.g., gives an error. Here is the image in the documentation:


missing mesh lines


Update: While the answer below works as requested, it does not work for tubes. See this example:


ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], 
Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}, Mesh -> 10,
BoundaryStyle -> Tube[.03], MeshStyle -> Tube[.03]]

enter image description here



Answer




You need to use BoundaryStyle -> ... (because 0 lies at the boundary of u and v ranges:


ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u],  Sin[v]},
{u, 0, 2 Pi}, {v, 0, 2 Pi}, ImageSize->500,
Mesh -> 10, BoundaryStyle ->Directive[Thick, Red]]

enter image description here


Update: Rendering mesh lines as Tubes


In Version 9.0.1.0


 ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], Sin[v]},
{u, 0, 2 Pi}, {v, 0, 2 Pi}, Mesh -> 10,

BoundaryStyle -> Tube[.03], MeshStyle -> Tube[.03]]

gives


enter image description here


In Version 10, you can post-process Lines into Tubes to get a similar result:


 ParametricPlot3D[{(2 + Cos[v]) Cos[u], (2 + Cos[v]) Sin[u], Sin[v]}, 
{u, 0, 2 Pi}, {v, 0, 2 Pi}, Mesh -> 10,
BoundaryStyle -> Automatic, MeshStyle ->Automatic]/. Line->Tube

gives



enter image description here


Comments