I'm trying to plot a vector field with 5 by 5 arrows (25 in total). It looks good, expect for the fact that it arbitrarily chooses "up" as the direction of the 0-vector. How can I tell it to not display 0-length arrows at all?
My code:
\documentclass{article}
\tikzset{>=stealth}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\draw[->, thick] (-3,0)--(3,0) node[right] {$x$};
\draw[->, thick] (0,-3)--(0,3) node[above] {$y$};
\def\factor{0.15}
\foreach \x in {-2.5,-2,...,2.5} {
\foreach \y in {-2.5,-2,...,2.5}{
\draw[->] (\x,\y)--++(\factor*\y,-\factor*\x);
}
}
\end{tikzpicture}
\end{document}
Result (note the arrow tip at the origin):
Best Answer
One possibility with
\ifthenelse
: