\documentclass[a4paper]{article}

\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{clickable}

\begin{document}
\begin{tikzpicture}
	\begin{axis}[xlabel=$x$,ylabel=$y$,
		domain=-2:2,
		samples=17,
		legend style={at={(0.5,0.98)},anchor=north,legend columns=-1}
	]
		\addplot {x};
		\addplot {x^2};
		\addplot {x^3};
		\legend{$x$,$x^2$,$x^3$}
	\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
	\begin{semilogyaxis}[
		xlabel=$x$,ylabel=$f(x)$,
		samples=10,
		domain=0:6,
		legend style={at={(0.5,0.98)},anchor=north,legend columns=-1}
	]
		\addplot {exp(x)};
		\addplot {10^x};
		\legend{$\exp(x)$,$10^x$}
	\end{semilogyaxis}
\end{tikzpicture}
\end{document}

