I would like to plot the graph for y = |sin(pi*x)| on the interval -2.5 and 2.5. (The graph is on or above the x-axis, and both ends are at height 1.) TikZ plots a line through the origin. The label for the graph should be to the right end of the graph - it can extend past the x-axis. How to I add the label "x" to the x-axis and "y" to the y-axis?
\documentclass[10pt]{amsart}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\hspace*{\fill}
\begin{tikzpicture}
\begin{axis}[width=4in,axis equal image,
xmax=3,ymax=1.5,
axis lines=middle,
restrict y to domain=-1:2,
enlargelimits,
axis line style={shorten >=-0.25cm,shorten <=-0.25cm,latex-latex},
ticklabel style={fill=white},
extra x ticks={-2,-1,0,1,2},
%extra x tick style={grid=none}
]
\addplot[domain=-2.5:2.5,mark=none,samples=200] {abs(sin(pi(x)))} node[fill=white, below left, yshift=-3pt]{$y=\vert\sin(\pi x)\vert$};
\end{axis}
\end{tikzpicture}
\hspace{\fill}

xlabel=$x$,ylabel=$y$to the options. – percusse Sep 17 '14 at 01:28