# Placing an image below a table which relate to each other on the same page

I have a table made up of the following LaTeX:

\begin{table} [htbp]
\centering
\begin{tabular} {lrrr}
\toprule
\multicolumn{1}{l}{\textbf{Category}} & \multicolumn{3}{c}{\textbf{Type}} \\
\multicolumn{1}{l}{} & \multicolumn{1}{l}{\textbf{Automatic}} & \multicolumn{1}{l}{\textbf{Semi-automatic}} & \multicolumn{1}{l}{\textbf{Manual}} \\
\midrule
Category 1                              &   0 &   1 &   1 \\
Category 2                              &  20 &  28 &  12 \\
...
\midrule
Total                                   & 121 & 170 &  59 \\
\bottomrule
\end{tabular}
\caption{Text of caption...}.
\label{tab:myTable}
\end{table}


Which works perfectly well. But I would like to place a related chart beneath this table. The chart is written in Excel and saved as a .png graphic file.

Is there a way I can 'link' the table and graphic file so that they are always together and remain on the same page, a float or other LaTeX form?

I am looking for something like this for the page layout:

• if both will fit on the same page, and the "graphic" is really a table in disguise, you could just put them both into the same float -- unless you insist on listing one in the "list of tables" and the other in the "list of figures". (and even then, there is probably a workaround.) – barbara beeton Sep 28 '15 at 20:23
• An interesting idea. However, the graphics tend to be bar and column charts, word clouds and tree-maps. – Mr Morgan Sep 28 '15 at 20:29

There's nothing illegal or improper about including a graphic (with an \includegraphics directive, say) in a table environment. To generate a caption of the form "Figure : ...", be sure to load the caption package and use a \captionof{figure}{...} instruction

\documentclass{article}
\usepackage{booktabs}
\usepackage{caption} % for "\captionof" macro
\usepackage[demo]{graphicx} % omit 'demo' option in real document
\begin{document}
\begin{table}[p]
\centering
\begin{tabular} {lrrr}
\toprule
\textbf{Category} & \multicolumn{3}{c}{\textbf{Type}} \\
& \textbf{Automatic} & \textbf{Semi-automatic} & \textbf{Manual} \\
\midrule
Category 1   &   0 &   1 &   1 \\
Category 2   &  20 &  28 &  12 \\
\dots \\
\midrule
Total        & 121 & 170 &  59 \\
\bottomrule
\end{tabular}
\caption{Text of table caption \dots}
\label{tab:myTable}

\vspace*{2cm}  % set amount of vertical offset
\includegraphics[width=0.5\textwidth,
height=1\textwidth]{test}
\captionof{figure}{Text of figure caption \dots}
\label{fig:myFigure}
\end{table}
\end{document}

• The only issue I have with this is that if I put a label on the graphic such as \label{fig:This figure}, LaTeX will treat the graphic as a table. Can this be changes so that LaTeX treats the graphic as a figure? – Mr Morgan Sep 28 '15 at 21:40
• @MrMorgan - Should the figure-related caption be numbered, e.g., as "Figure 1"? – Mico Sep 28 '15 at 21:42
• Yes. Both table and figure are linked in that they show the same data, but they should have distinct table and figure numbering. – Mr Morgan Sep 28 '15 at 21:44
• @MrMorgan - That'll be an easy fix. Give me a couple of minutes to update the code. – Mico Sep 28 '15 at 21:45