3

I want to draw the following number line diagram. How can I do this?

enter image description here Thanks. Please disregard the stray mark under the word 'some'. :)

Here is what I am able to do.

  \documentclass{article}
  \usepackage{tikz}
  \usetikzlibrary{arrows}
  \begin{document}
  \tikz\draw [<-o] (0,0) node[pos=0, below] {$-3$}-- +(1,0);
  \end{document}
Peter Grill
  • 223,288
  • 1
    You can do this with tikz. Please make an attempt and post a specific question as to where you are stuck. For instance, can you draw the horizontal line? If so, can you add the circle? the label?, the arrow? the squiggly line? – Peter Grill Jun 11 '14 at 05:50
  • I am afraid I do not know how to do any of these. I know very little tikz. I've looked at a few question such as this and tried to figure it out. But it doesn't work out. :( –  Jun 11 '14 at 05:58
  • So it is the squiggly you are having difficulty with. Can you at least have a look at the tikz manual and draw the straight line? – Peter Grill Jun 11 '14 at 06:00
  • Yes, I can draw the straight line. The squiggly line and the arrow pointing towards the text I'm stuck with. Also, how do I insert the number 3 on there? –  Jun 11 '14 at 06:02
  • 1
    Ok, then please edit the question and post a fully compilable MWE including \documentclass and shows how far you can got and ask a specific question about the squiggly and the arrow. That way those trying to help have something to start with. – Peter Grill Jun 11 '14 at 06:05

1 Answers1

17

I'll post a working code example here. Take this code as a starting point using the possibilities you have with tikz and its libraries. For detailed informations about the used parts please have a look at the pgfmanual.

Important: It's worth looking at the Example Sections of the pgfmanual to get some good point to start with. Quite all the information you need for this can be found there.

\documentclass[border=6mm, 11pt]{standalone}

\usepackage{tikz}
\usetikzlibrary{calc, positioning, decorations.pathmorphing}

\begin{document}
 \begin{tikzpicture}
  % Circle node
  \node at (0,0) [circle, draw, thick, label={-90:-3}] (circ) {};
  % Left side with zigzag part
  \draw [thick, ->, >=latex] (circ) decorate [decoration={zigzag, segment length=.1cm, amplitude=.1cm}] {-- ++(-1,0)} -- ++(-2,0);
  % Right side
  \draw [thick, ->, >=latex] (circ) -- ++(2,0);
  % Text node with arrow to zigzag part
  \node at (-2,-1) [label={[label distance=-.5cm]-45:Some text goes here}] (text) {};
  \draw [->] (text) to [looseness=2, in=90, out=90] ($(circ.north)+(-.5,0)$);
 \end{tikzpicture}
\end{document}

The code will give you the following image: enter image description here

EDIT: Shortened version (just for interest)

\begin{tikzpicture}[>=latex]
 \draw [<->, thick] (0,0) -- ++(2,0) decorate [decoration={zigzag, segment length=.1cm, amplitude=.1cm}] {-- ++(1,0)} -- ++(.15,0) node (circ) [draw, fill=white, circle, label={-90:-3}] {} -- ++(2,0);
 \draw [->, shorten <= .25cm] (1,-1) node [label={[label distance=-.5cm]-45:Some text goes here}] {} to [in=90, out=90, looseness=2] (circ);
\end{tikzpicture}
moospit
  • 4,456