Menu

#46 arrow tips on plotted functions

Next Release
closed-fixed
nobody
None
5
2014-08-16
2009-04-23
Anonymous
No

I'd like to be able to place arrow tips at the end of plotted functions to show how the function extends. E.g., here's a plot of the throughput of an aloha network. Notice the arrow tip is pointing in the wrong direction (up instead of to the right).

%aloha throughput
\begin{tikzpicture}[x=1cm,y=5cm]
\draw[black!30] (0,0.368) -- (1,0.368) -- (1,0);
\draw (0,0.368) node[left=3pt] {$0.368$};
\draw (1,0) node [below=3pt] {$1$};
\draw[<->] (0,0.44) -- (0,0) -- (5,0);
\draw [->,smooth,thick] plot[id=alohathroughput, domain=0:5,samples=30] function{x*exp(-x)};
\draw (3,0) node [below=5pt] {$\lambda$};
\draw[<-] (3,0.15) -- +(15:0.3) node [above right] {$\lambda e^{-\lambda}$};
\end{tikzpicture}

--CGB

Discussion

  • Chris Ball

    Chris Ball - 2010-02-22

    The functionality exists, but it seems to be that it is incompatible with the option smooth. Try the following code, which has the arrow head in the right direction.
    \begin{tikzpicture}[x=1cm,y=5cm,scale=3]
    \draw[black!30] (0,0.368) -- (1,0.368) -- (1,0);
    \draw (0,0.368) node[left=3pt] {$0.368$};
    \draw (1,0) node [below=3pt] {$1$};
    \draw[<->] (0,0.44) -- (0,0) -- (5,0);
    \draw [->,thick] plot[id=alohathroughput, domain=0:5,samples=30]
    function{x*exp(-x)};
    \draw (3,0) node [below=5pt] {$\lambda$};
    \draw[<-] (3,0.15) -- +(15:0.3) node [above right] {$\lambda
    e^{-\lambda}$};
    \end{tikzpicture}

    I suppose that the problem is now to make the option smooth compatible with the arrowheads...

     
  • Till Tantau

    Till Tantau - 2013-09-21

    I (finally) fixed this problem. Arrow tips on smooth curves work fine, now, in CVS.

     
  • Till Tantau

    Till Tantau - 2013-09-21
    • status: open --> closed-fixed
    • Group: --> Next Release (example)
     
MongoDB Logo MongoDB