# Misplaced figure

I don't understand why the figure is above the section title.

\documentclass[paper=a4, fontsize=11pt]{scrartcl}
\usepackage{graphicx}
\begin{document}

\clearpage
\section*{Códigos}

\begin{figure}
\begin{center}
\includegraphics[width=10cm]{fig/scilabKbarra}
\caption{Código \textit{Scilab} para cálculo de $\overline{K}$ e $K_t$}
\label{scilabKbarra}
\end{center}
\end{figure}

\end{document}

• a figure is a floating environment which by default can go to top of page, if you never want it to float backwards use \usepackage{flafter} – David Carlisle Jun 4 '15 at 18:44
• @DavidCarlisle Should I use both packages at the same time? – Eduardo Casseres Jun 4 '15 at 18:46
• there's some relevant information in the answer to this question: Flafter sometimes ignores a section title – barbara beeton Jun 4 '15 at 18:50
• the packages are not related graphicx defines commands for including graphics and rotation etc, such as \includegraphics whereas flafter (which is also part of the core latex release) modifies the float placement algorithm as used by figure. – David Carlisle Jun 4 '15 at 18:50

Usually helps if you add [h] as option for place holder:

\documentclass[paper=a4, fontsize=11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}

\begin{document}
\section*{Códigos}

\begin{figure}[h]% <--- it say "let figure be here"
\centering
\includegraphics[width=10cm]{example-image}
\caption{Código \textit{Scilab} para cálculo de $\overline{K}$ e $K_t$}
\label{scilabKbarra}
\end{figure}

\end{document}