I am new to Latex, and am drawing an exponential function like this:
However, when my preview shows me this instead:
Here's my code:
\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.3}
\begin{figure}[!h]
\centering
\begin{tikzpicture}
\begin{axis}[axis x line=middle, axis y line=middle,
ymax=18,
ylabel=$y$,
xmin=0,xmax=5,xlabel=$x$,
samples=201,
legend pos=south east]
\addplot [blue,thick,domain=0:4] {16*(0.5)^x};
\end{axis}
\end{tikzpicture}
\end{figure}
How do I label correctly for the dotted line and their corresponding values on a and y axes?