# Problem with simple TikZ plot

I'm trying to make an explanatory graph that boils down to annotating curves between two arbitrarily placed points.

My TikZ/Tex code just isn't compiling even though it closely follows the manual; What am I doing wrong?

\documentclass{minimal}

\usepackage{tikz}
\usetikzlibrary{arrows,backgrounds,snakes,shapes}
\begin{document}

\begin{centering}
\begin{tikzpicture}[domain=0:4]
\draw[->] (-0.2,0) -- (4.2,0) node[right] {$\mu$};
\draw[->] (0,-1.2) -- (0,4.2) node[above] {$\sigma$};
\fill[color=red] (1,1) circle (1ex) {$a$};
\fill[color=blue]  (2,3) circle (1ex) {$b$};
\draw[->,color=black] (1,1) -- (2,3) node[right] {$ds_{ab}^2= 2KL$};
\end{tikzpicture}
\end{centering}
\end{document}

-
Please provide a full MWE. It is difficult to know whether it is because you expected it to be a pgfplots plot or a TikZ visualization plot. In both cases it is crucial to know whether you loaded the packages correctly. However, your fill commands are wrongly formatted (they miss a node statement). –  zeroth Sep 20 '12 at 15:53
I expected it to be a TikZ visualization plot. Also, MWE added. –  mac389 Sep 20 '12 at 15:57

The problem arises along the lines:

\fill[color=red] (1,1) circle (1ex) {$a$};
\fill[color=blue]  (2,3) circle (1ex) {$b$};


because here is not clear if you want to declare a node or just a circle. To make your document compile you have two solutions:

\documentclass{article} % first solution

\usepackage{tikz}

\begin{document}
\begin{centering}
\begin{tikzpicture}[domain=0:4]
\draw[->] (-0.2,0) -- (4.2,0) node[right] {$\mu$};
\draw[->] (0,-1.2) -- (0,4.2) node[above] {$\sigma$};
\fill[color=red] (1,1) circle (1ex);
\fill[color=blue]  (2,3) circle (1ex);
\draw[->,color=black] (1,1) -- (2,3) node[right] {$ds_{ab}^2= 2KL$};
\end{tikzpicture}
\end{centering}
\end{document}


or

\documentclass{article} % second solution

\usepackage{tikz}

\begin{document}
\begin{centering}
\begin{tikzpicture}[domain=0:4]
\draw[->] (-0.2,0) -- (4.2,0) node[right] {$\mu$};
\draw[->] (0,-1.2) -- (0,4.2) node[above] {$\sigma$};
\fill[color=red] (1,1) circle (1ex) node{$a$};
\fill[color=blue]  (2,3) circle (1ex) node{$b$};
\draw[->,color=black] (1,1) -- (2,3) node[right] {$ds_{ab}^2= 2KL$};
\end{tikzpicture}
\end{centering}
\end{document}


If the purpose is to insert a label inside circles I suggest to proceed as follows:

\documentclass{article}

\usepackage{tikz}

\begin{document}
\begin{centering}
\begin{tikzpicture}[->,domain=0:4]
\draw (-0.2,0) -- (4.2,0) node[right] {$\mu$};
\draw (0,-1.2) -- (0,4.2) node[above] {$\sigma$};
\node[circle, radius=1ex,fill=red,text=black] (a) at (1,1) {$a$};
\node[circle, radius=1ex,fill=blue,text=black] (b) at  (2,3) {$b$};
\draw[color=black] (a) -- (b) node[right=0.2cm] {$ds_{ab}^2= 2KL$};
\end{tikzpicture}
\end{centering}
\end{document}


which gives:

Notice that I shift the option -> because it is common to every \draw then to connect the two nodes, first labels were assigned when they have been declared. Using the node declaration for a and b rather than your \fill allows the arrow to not overrides the circle. Indeed, the first solution above reported would lead to:

A final annotation: the snakes library is outdated; you should load decorations, but for this specific drawing it isn't necessary, as the other ones, see my examples.

-