# Add numbers to snake(box plot)

I have the following code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,backgrounds,snakes}

\begin{document}

\begin{tikzpicture} [thick, framed]

\filldraw[fill=green!20] (2.85,0) rectangle (5.7,1);

\draw (4.45,0)--(4.45,1) node[above]{$\textsc{M}$};

\draw (5.7,0.5)--(11,0.5);%vandret linie til max

\draw (2.85,0.5)--(1,0.5);%vandret linie til min

\draw (11,0.39)--(11,0.61);

\draw (1,0.39)--(1,0.61);

\draw (0,-1) -- (11,-1);

\draw[snake=ticks,segment length=1cm] (0,-1) -- (11,-1);

\end{tikzpicture}

\end{document}


I would like to have numbers( like in a coordinate system) along with the line beneath the boxplot, how to do that?

I am very new with LaTeX so as basic as possible:-)

-
Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}). –  Claudio Fiandrino Aug 14 '12 at 7:12

You can use a \foreach loop to place nodes containing the tick labels.

Note that the snakes library is deprecated. Instead, you should use the decorations.pathreplacing library. The ticks are then added by setting decoration=ticks, decorate. You can combine the \draw commands for the line and the ticks into a single command by using a postaction. Specifying a postaction will draw the path a second time, using the options specified in the postaction argument. That way, if you want to change the size of your axis, you will only need to change the coordinates once.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,backgrounds,decorations.pathreplacing}

\begin{document}

\begin{tikzpicture} [thick, framed]
\filldraw[fill=green!20] (2.85,0) rectangle (5.7,1);
\draw (4.45,0)--(4.45,1) node[above]{$\textsc{M}$};
\draw (5.7,0.5)--(11,0.5);%vandret linie til max
\draw (2.85,0.5)--(1,0.5);%vandret linie til min
\draw (11,0.39)--(11,0.61);
\draw (1,0.39)--(1,0.61);
\draw [
postaction={
draw,
decoration=ticks,
segment length=1cm,
decorate,
}
] (0,-1) -- (11,-1);
\foreach \tick in {0,...,11}
\node at (\tick,-1) [below=1pt] {\tick};
\end{tikzpicture}
\end{document}

-