[Tex/LaTex] How to place image on same page as text

floatspositioning

I am new to LaTeX. I am trying to include and graph in .eps format in my LaTeX document. I shrink the image to half its size, but for some reason, LaTeX still putting it on its own page, with a small graph in the middle and a lot of white space. I would like this graph to be placed at the top of the page with text underneath. Any help would be greatly appreciated.

My packages are:

\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mitpress}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{float}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage[left=63.2363pt,right=63.2363pt,top=90.3375pt,bottom=90.3375pt]{geometry}

And the code for my figure is:

\begin{figure}[ht]
\centering
\includegraphics[trim = 0 0 0 0,clip=true,scale = 0.5]{graphs/fig_hazards_comb}
%\caption{This is the caption}
\end{figure}
\clearpage

Best Answer

The \clearpage below the figure forces the immediate placement of the figure and then a new page. It seems that the figure doesn't fit on the current page neither here nor on top. It is therefore pushed on the next page which is otherwise empty because of the directly following \clearpage.

LaTeX refuses to make a normal text page which only holds one figure and creates a "float only" page (p) where the figure (or figures if there would be more) is placed centered on the page independent of its size.

So to fix this remove the \clearpage and try how it works out. If you really want to force the placement of all unplaced floats use either \afterpage{\clearpage} (needs the afterpage package) or \FloatBarrier (placeins package).

Related Question