I'm trying to label some plots but I can't seem to figure it out. I am trying to get something that looks a bit like this:
Found in the texanmple website here. I would like to label the function corresponding to each plot as shown in the figure above.
This is what I have:
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}[plot/.style={very thick,raw gnuplot,mark=none,black}]
\begin{axis}[
minor y tick num=2,
minor x tick num=1,
extra y ticks={0},
extra x ticks={0},
extra tick style={grid style={black},xticklabel=\empty},
width=0.7\textwidth,
ymin=-2, ymax=2,
grid=both, y=1cm,
axis y line=left,
axis x line=bottom
]
\addplot gnuplot [plot, samples=500, restrict y to domain=-10:10] {
plot [-5:5] x**3 - x;
};
\addplot gnuplot [plot, blue, samples=500, restrict y to domain=-10:10] {
plot [-5:5] (x-3)**3 - (x-3);
};
\addplot gnuplot [plot, red, samples=500, restrict y to domain=-10:10] {
plot [-5:5] (x+3)**3 - (x+3);
};
\end{axis}\end{tikzpicture}
\end{document}
which produces:
I was hoping to stay in the axis-environment due to styling reasons.



