\documentclass{article} \usepackage{tikz} \usetikzlibrary{arrows} \usetikzlibrary{snakes} \usepackage{verbatim} \tikzstyle{mybox} = [draw=red, fill=blue!20, very thick, rectangle, rounded corners, inner sep=10pt, inner ysep=20pt] \begin{document} \begin{tikzpicture}[scale=1.2] %\begin{tikzpicture}[scale=3] %\draw[step=0.1, color=lightgray] (-1,-1) grid(4.5,4.5); %\draw[help lines] (-3,-1) grid (4,1); \draw [thick](-2.5,0) -- (3.5,0); \draw [thick, style=dotted](3.5,0) -- (4,0); \draw [thick, style=dotted](-3,0) -- (-2.5,0); \foreach \x/\xtext in {-2/x_2,0,1, 3/x_1} \draw[xshift=\x cm, thick] (0pt,1pt) -- (0pt,-1pt) node[below,fill=white] {$\xtext$}; \draw[snake=brace, mirror snake, color=blue] (-2,-0.4) -- (0,-0.4) node[midway,sloped,below] {$|x_1|$}; \draw[snake=brace, mirror snake, color=red] (0,-0.4) -- (3,-0.4) node[midway,sloped,below] {$|x_2|$}; % \foreach \x in {1,2,3} % \draw (\x cm,1pt) -- (\x cm,-1pt) node[anchor=north] {$\x$}; \end{tikzpicture} \end{document}