Given a parameterized sphere defined by:

ParametricPlot3D[{R[u, v]}, {u, 0, Pi}, {v, 0, 2*Pi}]

I want to draw the line from R[0,0] to R[$\pi$,$\pi$]. What is the simplest way? The end result should look something like this:

enter image description here


1 Answer 1


If you want to add a line that follows the path R[u, u] from u = 0 to u = π, you can use a single parameter ParametricPlot3D:

Show[ParametricPlot3D[R[u, v], {u, 0, Pi}, {v, 0, 2  Pi}, PlotStyle -> Opacity[.5]], 
 ParametricPlot3D[R[u, u], {u, 0, Pi}, PlotStyle -> Directive[Red, Thick]]]

enter image description here

Update: If you want to draw meridians from R[0,0] to R[π, π], you can use the option MeshFunctions -> {#5&} (or MeshFunctions -> {Function[{x,y,z,u,v},v]}) and specify the meridians you wish to show using the option Mesh:

ParametricPlot3D[R[u, v], {u, 0, Pi}, {v, 0, 2 Pi}, 
  PlotStyle -> Opacity[.5], 
  MeshFunctions -> {#5 &}, 
  Mesh -> {{{0, Purple}, {Pi/2, Red}, {Pi, Green}, {Pi/4, Magenta}, {5 Pi/3, Blue}}}, 
  MeshStyle -> Thick, BoundaryStyle -> None, 
  Method -> {"BoundaryOffset" -> False}, 
  PlotRangePadding -> Scaled[.05], 
  PlotLegends -> LineLegend[{Purple, Red, Green, Magenta, Blue},
     {0, Pi/2, Pi, Pi/4, 5 Pi/3}, LegendFunction -> Panel, LegendLabel -> "v"]] /. 
  Line -> (Tube[#, .025] &)

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.