6

What method should I use, to draw beautiful wavy arrows.

So far I tried the following. I use xy-pic package, there I use @{~>} definition for the arrow.

The code I've composed is like this:

\begin{figure}
\centering
\mbox{
\xygraph{
!{<0cm,0cm>;<1cm,0cm>:<0cm,1cm>::}
!{(0,0) }*+{\bullet_{x}}="x"
!{(2,0) }*+{\bullet_{v''}}="v"
!{(4,0) }*+{\bullet_{y}}="y"
!{(2,1) }*+{\bullet_{u}}="u"
!{(2,-2) }*+{\bullet_{z}}="z"
"x":@{~>}"v"
"v":@{~>}"y"
"y":@/_/@{~>}"u"
"u":"v"
"v":@{~>}"z"
}}
\end{figure}

And the result is like this:

A graph with wavy arrows

The problems that I see in this drawing are:

  • In the arrows from x to v'' and from v'' to y the composition of last "~" and the ending ">" is not good.
  • The arrow from v'' to z is cutted after each "~"
  • The arrow from y to u looks awful.

I search for a tip how to improve the quality of the figure. Thanks.

  • 3
    I can not answer your question, but I believe that the best would be not to use xy-pic - use TikZ instead. – hpekristiansen Dec 16 '12 at 13:29
  • @Hans-PeterE.Kristiansen I had a feeling that I have to switch to TikZ. I haven't used it before, so I wanted to stay with xy-pic. Thanks for advise. – jutky Dec 16 '12 at 14:28
  • And may be investigate tike-cd for this kind of graphs. – Manuel Dec 16 '12 at 14:34
3

The default arrow styles in the xypic are rather bad,arrow heads/tips styles can be changed with font family and it's size as mentioned in Ref­er­ence man­ual:Section 10 More Tips extension: Page 27 with

\SelectTips{<family>}{<size>}

Those broken arrows and inferior typesetting quality can be improved by loading xypdf package with pdf as an option like this \usepackage[pdf]{xypic}

Finally the improved version of your MWE with above tweaks and output is as follows, although you might consider tikz-cd for this job.

enter image description here

\documentclass{article}
\usepackage[all,pdf]{xy}
\begin{document}
\SelectTips{cm}{11}
\begin{figure}
\centering
\mbox{
\xygraph{
!{<0cm,0cm>;<1cm,0cm>:<0cm,1cm>::}
!{(0,0) }*+{\bullet_{x}}="x"
!{(2,0) }*+{\bullet_{v''}}="v"
!{(4,0) }*+{\bullet_{y}}="y"
!{(2,1) }*+{\bullet_{u}}="u"
!{(2,-2) }*+{\bullet_{z}}="z"
"x":@{~>}"v"
"v":@{~>}"y"
"y":@/_/@{~>}"u"
"u":"v"
"v":@{~>}"z"
}}
\end{figure}
\end{document}
  • In the end I used tikz to reach the goal. But according to the question, your answer solves it in the required way. Therefore, I accept it. – jutky Feb 23 '14 at 12:37
5

I realize the OP wanted a solution with xy-pic, but since there was such low activity and others may find them useful, here are some possible solutions using tikz-cd and plain tikz:

Option 1: tikz-cd

\documentclass{standalone}
\usepackage{tikz-cd}
\usetikzlibrary{decorations.pathmorphing}

\begin{document}
\begin{tikzcd}[%
  arrows={decorate, decoration={snake,segment length=1.64mm,amplitude=0.2mm}}
]
~            & & u \arrow[decorate=false]{d} & &                           \\
x \arrow{rr} & & v'' \arrow{rr} \arrow{dd}   & & y \arrow[bend right]{llu} \\
             & &                             & &                           \\
             & & z                           & &
\end{tikzcd}
\end{document}

enter image description here

Option 2: tikz

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}

\begin{document}
\begin{tikzpicture}[%
  foo/.style={%
    ->,
    shorten >=4pt,
    shorten <=4pt,
    decorate,
    decoration={%
      snake,
      segment length=1.64mm,
      amplitude=0.2mm,
      pre length=4pt,
      post length=4pt,
    }
  }
]
  \coordinate (v'') at ( 0, 0);
  \coordinate (u)   at ( 0, 1);
  \coordinate (x)   at (-2, 0);
  \coordinate (y)   at ( 2, 0);
  \coordinate (z)   at ( 0,-2);
  \foreach \pt in {u,v'',x,y,z} {
    \fill (\pt) circle (2pt) node[below right] {$\pt$};
  }
  \draw[foo] (x) -- (v'');
  \draw[foo] (v'') -- (y);
  \draw[foo] (v'') -- (z);
  \draw[foo] (y) to[in=-5,out=120] (u);
  \draw[foo,decorate=false] (u) -- (v'');
\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.