Please help me reduce the gap between the figure and the header in my code. I tried using position specifiers like h! or H but those take the figure on to the header slightly. I tried using vspace* but that also gave the same result. So, please help me.
\documentclass{article}
\usepackage{xcolor}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{layout}
\usepackage{float}
\usepackage{fancyhdr,adjustbox}
\usepackage{subfig}
\usepackage{titlesec}
\usepackage[margin=0.5in]{geometry}
\usepackage{colortbl}
\usepackage{filecontents}
\usepackage{array}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage[font=small,compatibility=false]{caption}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\lhead{\includegraphics[scale=0.4]{headerpic.jpg}}
\chead{}
\rhead{ 10th }
\addtolength{\topmargin}{.1in}
\definecolor{bblue2}{HTML}{00BFFF}
\definecolor{bblue}{HTML}{4F81BD}
\definecolor{rred}{HTML}{C0504D}
\definecolor{ggreen}{HTML}{9BBB59}
\definecolor{ppurple}{HTML}{eb6100}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
axis x line=bottom,
axis y line=left,
width = 0.85*\textwidth,
height = 8cm,
major x tick style = transparent,
ybar,
bar width=20pt,
ymajorgrids = true,
ylabel = {K Score},
symbolic x coords={
learning,engagement,safety,collaboration
},
xtick = data,
scaled y ticks = false,
enlarge x limits=0.25,
ymin=0,
legend cell align=left,
nodes near coords,
nodes near coords align={vertical},
legend style={
at={(1,1.05)},
anchor=south east,
column sep=1ex
}
]
\addplot[style={bblue2,fill=bblue2,mark=none}]
coordinates {
(learning,3.94) (engagement,4.17) (safety,3.44) (collaboration,4.32)
};
\legend{Categories}
\end{axis}
\end{tikzpicture}
\caption{\textit{Overall Metrics} }
\end{figure}
\end{document}

[!h]option (and not[h!]), it's OK for me. – Bernard Jul 02 '14 at 13:28figure-- just put it where you want it (using “ordinary” positioning), and use\captionof(from thefloatpackage) to caption it. – wasteofspace Jul 02 '14 at 14:12