Question
I want to attach a label to the curves I draw.
My current solution is to add a node after the plot of my function (see the code below). But, when I explicitly cut out a part of my graph, with the option clip = true, the label can be completely away from the curve (see the picture below).
Do you have an idea on how to resolve this issue, or a different approach to the issue of labeling my curves? I am looking for an automatic solution, if possible.
Picture

Code
\documentclass{article}
\usepackage[x11names]{xcolor}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}[domain=0.01:5]
\begin{axis}
[grid = major,
clip = true,
clip mode=individual,
axis x line = middle,
axis y line = middle,
xlabel={$x$},
xlabel style={at=(current axis.right of origin), anchor=west},
ylabel={$y$},
ylabel style={at=(current axis.above origin), anchor=south},
domain = 0.01:5,
xmin = 0,
xmax = 5,
enlarge y limits={rel=0.13},
enlarge x limits={rel=0.07},
ymin = -10,
ymax = 10,
after end axis/.code={\path (axis cs:0,0) node [anchor=north west,yshift=-0.075cm] {0} node [anchor=south east,xshift=-0.075cm] {0};}]
\addplot[color=Firebrick2, samples=100, smooth, ultra thick] {x^2}
node(endofplotsquare){} ;
\node [right, color=Firebrick2] at (endofplotsquare) {$x^2$};
\addplot[color=DodgerBlue2, samples=100, smooth, ultra thick] {exp(x)};
\addplot[color=Gold3, samples=1000, smooth, ultra thick, unbounded coords=jump, no markers] {ln(x)};
\end{axis}
\end{tikzpicture}
\end{document}

