6

I'm looking for a way to draw a tube around a function. I already defined my function (see code below). The distance between tube and function shoulb be equal in each point -> see for example arrows in the picture below.

I'm looking just for the tube outside, the arrows are just for explanation.

\documentclass[11pt]{standalone}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}[scale = 2]
\begin{axis}[
    hide axis,
    domain=0:100,
    samples=100]

\addplot[BrickRed,domain=0:100,ultra  thick, no marks] {sin(x*5.34)+cos(x)};

\end{axis}          
\end{tikzpicture}
\end{document}

Output from the code above

enter image description here

  • Apparently this must be a curves that has the same slope everywhere as the original curve but not the same curvature – user31729 Jan 27 '16 at 17:47
  • Do you know, how to achieve this? – d4rty Jan 27 '16 at 17:52
  • 1
    You can put \addplot[double, double distance=15pt,domain=0:100, line width=1pt, no marks] {sin(x*5.34)+cos(x)}; before your actual plot (the double key does pretty much what @daleif suggested) – Jake Jan 27 '16 at 18:39
  • 1
    @Jake sorry, I took your answer. Hadn't seen in. I was looking in my own questions I had asked. Sorry – Arne Timperman Jan 27 '16 at 18:55
  • 1
    @Arne: No worries! – Jake Jan 27 '16 at 18:58
12

Here you are...

\documentclass[11pt]{standalone}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
 \usepackage{pgfplots}
 \begin{document}
\begin{tikzpicture}[scale = 2]
\begin{axis}[
hide axis,
domain=0:100,
samples=100]

\addplot[BrickRed,domain=0:100,ultra  thick, double=brown!40,double   distance=10pt, no marks] {sin(x*5.34)+cos(x)};
\addplot[BrickRed,domain=0:100,ultra  thick, no marks] {sin(x*5.34)+cos(x)};

\end{axis}          
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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