# How to make this plot?

Found this beautiful plot here but I don't know how to write the code for the Mathematica plot... I found the parameterization

$\begin{pmatrix}x\\y\\z\end{pmatrix} = \begin{pmatrix}[2+\cos(u)]\cos(v)\\ [2 + \cos(u + 2 \pi / 3)] \cos(v + 2 \pi / 3) \\ [2 + {\rm{sign}}(F(u)) \sqrt{|F(u)|}] {\rm{sign}}(F(v)) \sqrt{|F(v)|} \end{pmatrix}$

where $F(s) = 1 - \cos(s)^2 - \cos(s + 2 \pi / 3)^2$ and $0\le u\le 2\pi$, $0\le v\le 2\pi$

It should be possible, but I just can't figure out how to do it.

Would be nice if someone could help me.

With your help I've come this far The Code I'm currently woriking with is

ParametricPlot3D[{(2 + Cos[u]) Cos[v], (2 + Cos[u + (2 \[Pi])/3]) Cos[
v + (2 \[Pi])/3], (2 + Sign[F[u]]) Sqrt[Abs[F[u]]]
Sign[F[v]] Sqrt[Abs[F[v]]]}, {u, 0, 2 \[Pi]}, {v, 0, 2 \[Pi]},
Mesh -> All, MeshFunctions -> Automatic, PlotPoints -> 200,
Boxed -> False, Axes -> False, Exclusions -> None,
PlotRangePadding -> None, ColorFunction -> Hue,
PlotTheme -> "Simple"]


The Problem is, that I want the mesh to be coloured and the space between the lines to be empty. But that's not really working..

Has anyone a idea how to implement that?

Thanks

• Use ParametricPlot3D. Apr 11, 2017 at 20:56
• What's the source? Also, please give the equations in Mathematica syntax. Apr 11, 2017 at 21:25

directly drawing grid lines:

F[u_] = 1 - Cos[u]^2 - Cos[u + 2/3 Pi]^2;
g[u_, v_] = {
(2 + Cos[u]) Cos[v],
(2 + Cos[u + (2 \[Pi])/3]) Cos[v + (2 \[Pi])/3],
(2 + Sign[F[u]]) Sqrt[Abs[F[u]]] Sign[F[v]] Sqrt[Abs[F[v]]]};
Graphics3D[
{Table[Line[#, VertexColors -> (Hue /@ (#[[All, 1]]/3 /Pi))] &@
Table[ g[u, v] , {u, 0, 2 Pi, Pi/40}], {v, 0, 2 Pi, Pi/40}],
Table[Line[#, VertexColors -> (Hue /@ (#[[All, 1]]/3 /Pi))] &@
Table[ g[u, v] , {v, 0, 2 Pi, Pi/40}], {u, 0, 2 Pi, Pi/40}]},
Boxed -> False] • One could use ParametricPlot3D[] with an appropriate ColorFunction, too. Apr 13, 2017 at 15:05

Too long for a comment.

It is certainly very different from your plot, but this is what I got using your parametrisation and ParametricPlot3D as suggested by Szabolcs and Exclusions->None as suggested by J.M.: F[s_] = 1 - Cos[s]^2 - Cos[s + 2 Pi/3]^2;
ParametricPlot3D[{(2 + Cos[u]) Cos[v], (2 + Cos[u + 2 Pi/3]) Cos[
v + 2 Pi/3], (2 + Sign[F[u]])*
Sqrt[Abs[F[u]]] Sign[F[v]] Sqrt[Abs[F[v]]]}, {u, 0, 2 Pi}, {v, 0,
2 Pi}, PlotPoints -> 200, Boxed -> False, Axes -> False,
Exclusions -> None, PlotRangePadding -> None]


For fun, we can add the following options taken from the documentation of ParametricPlot3D:

Mesh -> 100, MeshFunctions -> {#5 - 3 #4 &},
ColorFunction -> Function[{x, y, z, u, v}, Hue[u/(2 Pi)]],
ColorFunctionScaling -> False,  MeshShading -> {Black, Automatic, Automatic},
MeshStyle -> None] You might get further help by being more specific about what issues you are facing.

• You might want to add Exclusions -> None. Apr 12, 2017 at 2:27
• @J.M. Thanks, edited. Apr 12, 2017 at 2:40