I am getting an out of float error, here is the code:
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\begin{document}
\begin{center}
\begin{tikzpicture}
\begin{axis}[%
,xlabel=$N$
,ylabel=speedup
,axis x line=bottom
,axis y line=left
]
\addplot[very thick] coordinates {(755,1.4) (1978, 1.6) (6273, 1.8) (12222, 2.1)};
\end{axis}
\end{tikzpicture}
\end{center}
% Where to put the caption?
%\caption{\label{plot:speedup}Speedup of distributed execution, versus serial. N is the leading dimension of the matrix.}
\end{document}
Best Answer
You get an
out of float error
because you used a\caption
out side the float environment known asfigure
. A\caption
can only be inserted between\begin{<float environment>} ... \end{<float environment>}
.Put the
\caption
after the end oftikzpicture
, directly after the\end{tikzpicture}
line. Also, use\centering
instead of\begin{center} ... \begin{center}
inside float environments to get consistent spacing around floats. Finally, for readability purposes, drop the\label
on a separate line after\caption
.Another option if you don't like the
figure
environment is to use\captionof{<float>}
from thecaption
package. You will get the same result.