I would like to combine several pgfplot pictures in one figure with the help of the subfigure package. The code is the following:
\usepackage{subfigure}
\usepackage{pgfplots}
% Image:
\begin{figure}[ht!]
\centering
\subfigure[Subcaption 1]{ % First example plot from the manual
\begin{tikzpicture}
\begin{axis}[
xlabel=Cost,
ylabel=Error]
\addplot[color=red,mark=x] coordinates {
(2,-2.8559703)
(3,-3.5301677)
(4,-4.3050655)
(5,-5.1413136)
(6,-6.0322865)
(7,-6.9675052)
(8,-7.9377747)
};
\end{axis}
\end{tikzpicture}} \\
\subfigure[Subcaption 2]{ % Second example plot from the manual
\begin{tikzpicture}
\begin{axis}[
xlabel=$x$,
ylabel={$f(x) = x^2 - x +4$}
]
% use TeX as calculator:
\addplot {x^2 - x +4};
\end{axis}
\end{tikzpicture}}
\caption{{Caption}}
\end{figure}
However, what I see is this:

As you can notice, all labels are totally broken. Furthermore, colors are also damaged and some styles are not appropriately applied. What is going on here? What am I doing wrong? Is there a better solution for multiple plots in a single figure, where each plot gets its own caption?
PS: I had to upload the image at an external host as I was not allowed to upload it here.
!in front of it to turn it into a link. A moderator or another user with edit privileges can then reinsert the!to turn it into an image again. – Torbjørn T. Nov 18 '11 at 15:23subcaptionpackae or maybe tosubfig– Martin H Nov 18 '11 at 16:07