1

I found this code in an answer to this question here Help drawing a very simple number line using TikZ

\documentclass[letterpaper]{article}
\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}
\draw[latex-latex] (-3.5,0) -- (3.5,0) ; %edit here for the axis
\foreach \x in  {-3,-2,-1,0,1,2,3} % edit here for the vertical lines
\draw[shift={(\x,0)},color=black] (0pt,3pt) -- (0pt,-3pt);
\foreach \x in {-3,-2,-1,0,1,2,3} % edit here for the numbers
\draw[shift={(\x,0)},color=black] (0pt,0pt) -- (0pt,-3pt) node[below] 
{$\x$};
\draw[*-o] (0.92,0) -- (2.08,0);
\draw[very thick] (0.92,0) -- (1.92,0);
\end{tikzpicture}
\end{document}

Could you explain how I can edit this to add directed arc-shaped arrows from one number to another? (Like those used for a sequence).

1 Answers1

1

the line

\draw[*-o] (0.92,0) -- (2.08,0);

already draws an arrow. You only have to change the arrow head + tail (->), bend it (bend left), and change -- to to (otherwise both coordinates get an arrow head):

\draw[->, bend left] (0.92,0) to (2.08,0);

alternatively use the egde command and style it accordingly

\draw (0.92,0) edge[->, bend left] (2.08,0);

The bending properties can be further specified by

  • the angle in which it leaves a location, e.g. bend left=90.
  • the distance of the bending edge with, e.g. min distance=1cm
  • the looseness, which in this case is very similar to the distance, but behaves differently for loops, e.g. looseness=3

all together

\draw (0.92,0) edge[->, bend left=80, looseness=1.5] (2.08,0);

For more information have a look at the pgf manual, Section 70.3

Harald
  • 1,349