4

I am trying to make a spiral with text near the line just like

enter image description here

I have tried

\documentclass[tikz]{standalone}

\begin{document}

\begin{tikzpicture}
\draw [thick,->] (10, 0) -- (-10, 0) node [left] {Review};
\draw [thick,->] (0, -10) -- (0, 10) node [above] {Cumulative costs};
\draw [domain=0:-33, variable=\t, smooth, samples=75, ->] plot ({\t r}: {0.008*\t*\t});
\end{tikzpicture}

\end{document}

which produces the annotated axes and a spiral but I don't know how to write text along the spiral.

  • 1
    When you said "along a spiral", I thought you mean the baseline coincides with the spiral. However in reply to your diagram, lines like \node at({\t r}: {180+0.008*\t*\t}) would meet your goal. – Symbol 1 Jun 17 '15 at 7:46
  • By the way, your spiral looks more like r = √(θ^2+θ). – Symbol 1 Jun 17 '15 at 7:52
  • @Symbol1 Would you answer? – cfr Jan 19 '16 at 1:31
4

I can see two possibilities

In the first solution, I create another plot and place nodes on the curve using decorations.markings library. The library provides two ways to specify position: either measuring by length or by a factor of total length.

\documentclass[tikz,border=9]{standalone}
    \usetikzlibrary{arrows.meta,decorations.markings}
\begin{document}

\tikzset{nodes={font=\ttfamily,fill=white}}

\begin{tikzpicture}
    \draw[thick,arrows={->[length=10]}](8,0)--(-8,0)node [left] {Review};
    \draw[thick,arrows={->[length=10]}](0,-8)--(0,8)node [above] {Cumulative costs};
    \draw[domain=0:15,variable=\t,samples=440,smooth,arrows={->[length=10]}]
        plot({(-\t+1.5708) r}:{\t/3+2*\t/(0.1+\t)});
    \path[domain=0:15,variable=\t,samples=440,decorate,
            decoration={
                markings,
                mark=at position 2cm with \node{2cm};,
                mark=at position .3 with \node{pos=.3};,
            }
        ]
        plot({(-\t-1.5708) r}:{\t/3+2});
\end{tikzpicture}

Another way is to create a new style which moves nodes to where we want by the parameterization we define.

\begin{tikzpicture}[
        declare function={
            f(\t)=90-\t*90;
            g(\t)=\t/2+2*\t/(0.1+\t);
            f2(\t)=-90-\t*90;
            g2(\t)=\t/2+2;
        },
        pos par/.style={
            shift={({f2(#1)}:{g2(#1)})}
        }
    ]
    \draw[thick,arrows={->[length=10]}](8,0)--(-8,0)node[left]{Review};
    \draw[thick,arrows={->[length=10]}](0,-8)--(0,8)node[above]{Cumulative costs};
    \draw[domain=0:10,variable=\t,smooth,samples=440,arrows={->[length=10]}]
         plot({f(\t)}:{g(\t)});
    \path node[pos par=0]{pos par=0}
          node[pos par=1]{pos par=1}
          node[pos par=2]{pos par=2}
          node[pos par=3]{pos par=3}
          node[pos par=4]{pos par=4}
          node[pos par=5]{pos par=5}
          node[pos par=6]{pos par=6}
          node[pos par=7]{pos par=7}
          node[pos par=8]{pos par=8};
\end{tikzpicture}

\end{document}

By the way, \t/(1+\t) (as well as its linear transformations) is a function that "climbs" to 1 and stays there. I add this function in order to embellish the archimedean spiral so that there would be enough room for the first label.

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.