1

I want to draw a sinuous arrow between two nodes. Following the first answer in this thread Easy curves in TikZ I have tried the following code, but the arrow head points to the opposite side... how could I solve it? Thanks!

\documentclass{article}

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    \node (A) at (0,0) {\includegraphics[scale=.1]{images/presentation/2/cell.png}};
    \node (B) at (8,-1) {\includegraphics[scale=.1]{images/presentation/2/cell2.png}};
    \draw[->, >=latex, blue, line width=6pt] (A.east) to (B.west);
    \draw [->, cyan, line width=3pt] plot [smooth, tension=1] coordinates{ ([yshift=.5cm]A.east) (2,2.5) (4,2) (6,3) ([yshift=.5cm]B.west)}; %this arrow head should point to the other side

\end{tikzpicture}
\end{document}
  • It looks like TikZ doesn’t know the incoming direction and calculates atan(0/?) = 90° (a typical sign that something went wrong). I fear that arrows do not work with plot out of the box … Using Jake’s answer and the absolute supports key, TikZ places the arrow tip correctly. By the way, we do not have these images. We’ll use \usepackage[demo]{graphicx}. – Qrrbrbirlbel Jun 28 '13 at 4:40
1

I think this is the same problem with the to paths in Odd behaviour with arrows and multipart rectangles so a tiny nudge is required for TikZ to restore the path direction.

\documentclass[tikz]{standalone}
\usepackage{mwe}%<-- For dummy images
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
    \node (A) at (0,0) {\includegraphics[scale=.1]{example-image-a}};
    \node (B) at (8,-1) {\includegraphics[scale=.1]{example-image-b}};
    \draw[->, >=latex, blue, line width=6pt] (A.east) to (B.west);
    \draw [->,cyan, line width=3pt] 
               plot [smooth, tension=1] coordinates{%
                                                    ([yshift=.5cm]A.east)
                                                    (2,2.5)
                                                    (4,2)
                                                    (6,3)
                                                    ([yshift=5mm+5pt]B.west)}
                                                    --([yshift=5mm]B.west);

\end{tikzpicture}
\end{document}

enter image description here

  • Thanks a lot! It work perfectly!! sorry for the missing images, it was just to stress that there were actually images there, but any image would have been ok, like in your example. Thanks again! – DaniCee Jun 28 '13 at 16:53

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.