# Moebius strip border

I am trying to draw a red border of a Moebius strip. I have tried several things, playing with shader=faceted and mesh but I could not achieve this.

The code :

\documentclass[english]{article}
\usepackage{pgf,pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
hide axis,
view = {40}{40}
]
surf,
colormap={blackwhite}{gray(0cm)=(1); gray(1cm)=(0.5)},
shader     = faceted interp,opacity = 0.7,
point meta = x,
samples    = 40,
samples y  = 4,
z buffer   = sort,
domain     = 0:360,
y domain   =-0.5:0.5
] (
{(1+0.5*y*cos(x/2)))*cos(x)},
{(1+0.5*y*cos(x/2)))*sin(x)},
{0.5*y*sin(x/2)}
);
\end{axis}
\end{tikzpicture}
\end{document}


Do you have an idea?

Welcome to TeX-SE! You could just draw the contours separately.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
hide axis,
view = {40}{40}
]
domain     = 360:720,samples y=0,
] (
{(1+0.5*0.5*cos(x/2)))*cos(x)},
{(1+0.5*0.5*cos(x/2)))*sin(x)},
{0.5*0.5*sin(x/2)}
);
surf,
colormap={blackwhite}{gray(0cm)=(1); gray(1cm)=(0.5)},
shader     = faceted interp,opacity = 0.7,
point meta = x,
samples    = 40,
samples y  = 4,
z buffer   = sort,
domain     = 0:360,
y domain   =-0.5:0.5
] (
{(1+0.5*y*cos(x/2)))*cos(x)},
{(1+0.5*y*cos(x/2)))*sin(x)},
{0.5*y*sin(x/2)}
);
domain     = -140:497.5,samples y=0,samples=(640/360)*24+1,
] (
{(1+0.5*0.5*cos(x/2)))*cos(x)},
{(1+0.5*0.5*cos(x/2)))*sin(x)},
{0.5*0.5*sin(x/2)}
);
\end{axis}
\end{tikzpicture}
\end{document}


• where is the duck? tex.stackexchange.com/a/424140/2388 – Ulrike Fischer Jun 21 at 15:02
• @UlrikeFischer AFAIK the duck got eaten by the Bär. – user121799 Jun 21 at 15:05
• I would give a +1 if you used a different colour for each edge. – David Carlisle Jun 21 at 15:15
• @DavidCarlisle The color is entirely fixed by the user name of the OP, so that is not possible. – user121799 Jun 21 at 15:18