[Tex/LaTex] Insert Figures Error: Not in outer par mode

errors

this is my first time that i use latex but im trying to put some pngs and eps image files but i get the error "Error: Not in outer par mode. "
please help.

\documentclass[journal]{IEEEtran}
\usepackage{graphicx}

\begin{document}

\title{Bare Demo of IEEEtran.cls for Journals}

\author{Michael~Shell,~\IEEEmembership{Member,~IEEE,}
       John~Doe,~\IEEEmembership{Fellow,~OSA,}
      and~Jane~Doe,~\IEEEmembership{Life~Fellow,~IEEE}% <-this % stops a space
\thanks{M. Shell is with the Department of Electrical and Computer Engineering, Georgia Institute of Technology, Atlanta, GA, 30332 USA e-mail: (see http://www.michaelshell.org/contact.html).}% <-this % stops a >space
\thanks{J. Doe and J. Doe are with Anonymous University.}% <-this % stops a space
\thanks{Manuscript received April 19, 2005; revised December 27, 2012.}}

\markboth{Journal of \LaTeX\ Class Files,~Vol.~11, No.~4, December~2012}%
{Shell \MakeLowercase{\textit{et al.}}: Bare Demo of IEEEtran.cls for Journals}


\maketitle

\begin{abstract}
The abstract goes here.
\end{abstract}

\begin{IEEEkeywords}
IEEEtran, journal, \LaTeX, paper, template.
\end{IEEEkeywords}

\IEEEpeerreviewmaketitle

\section{Actividades}
Se lanzo un dado equilibrado de seis caras un numero suficiente de veces hasta hasta completar 120 series. Una serie consiste en un numero de lanzamientos que terminaba cuando aparecia el primer exito. El exito consistia en conseguir un multiplo de 3. Acontinuacion se procedio a registrar los datos sus frecuencias relativas y compararlas >con el modelo matematico.

\section{Experimentos}

\begin{table}
\begin{tabular}{|c|c|c|}
\hline
($i$)&($f_i$)&($P_i$)\\
\hline
1&0.317&0.333\\
2&0.292&0.222\\
3&0.150&0.148\\
4&0.058&0.099\\
5&0.058&0.066\\
6&0.033&0.044\\
7&0.058&0.029\\
8&0.017&0.020\\
9&0.008&0.013\\
10&0.000&0.009\\
11&0.008&0.006\\
\hline
\end{tabular}


\begin{figure}
\centering
        \includegraphics[widht=\textwidht]{C:/Users/Tzukasa/Pictures/grafico.png}
\label{fig:grafico}
\end{figure}


\begin{figure}
\includegraphics[width=0.90\textwidth]{barra2.eps}
\caption{Frecuencias empiricas y teoricas para el numero de lanzamientos de un dado necesarios para obtener un multiplo de 2}
\label{barra2}
\end{figure}

\caption{Frecuencuas relativas ($f_i$) y probabilidades te\'oricas ($P_i$) para el numero de intetos necesarios ($i$) para obtener el primer m\'ultiplo de 3 al lanzar un dado.}
\label{tablaExp1}
\end{table}

\IEEEPARstart{T}{his} demo file is intended to serve as a ``starter file''
for IEEE journal papers produced under \LaTeX\ using
IEEEtran.cls version 1.8 and later.

I wish you the best of success.

\hfill mds

\hfill December 27, 2012

\subsection{Subsection Heading Here}
Subsection text here.

\subsubsection{Subsubsection Heading Here}
Subsubsection text here.


\section{Conclusion}
The conclusion goes here.


\appendices
\section{Proof of the First Zonklar Equation}
Appendix one text goes here.

\section{}
Appendix two text goes here.


\section*{Acknowledgment}


The authors would like to thank...

\ifCLASSOPTIONcaptionsoff
 \newpage
\fi


\begin{thebibliography}{1}

\bibitem{IEEEhowto:kopka}
H.~Kopka and P.~W. Daly, \emph{A Guide to \LaTeX}, 3rd~ed.\hskip 1em plus
  0.5em minus 0.4em\relax Harlow, England: Addison-Wesley, 1999.

\bibitem{Esparza2013}
A. Esparza, \emph{A Guide to \LaTeX}, 3rd~ed \hskip 1em plus 0.5em minus 0.4em\realx Harlow England: Addison-Wesley, 1999.

\end{thebibliography}


\begin{IEEEbiography}{Michael Shell}
Biography text here.
\end{IEEEbiography}

\begin{IEEEbiographynophoto}{John Doe}
Biography text here.
\end{IEEEbiographynophoto}

\begin{IEEEbiographynophoto}{Jane Doe}
Biography text here.
\end{IEEEbiographynophoto}

\end{document}

Best Answer

the error is being reported because you can't nest one float inside another, and you appear to be trying here to include two figures inside a (floating) table.

if they are meant to be a unit, then omit the figure wrappers, and just include the \includegraphics commands, using a separate package to add the captions. the package caption provides the command \captionof to handle such situations.

the first figure, with the \label{fig:grafico}, will not be properly referenceable, since there is no caption that the label can be attached to.