# How do I place a table next to a chart?

I am doing my chemistry report where I have on the left side a graph and currently right below it the raw data. I like for them both to be side to side as I am going to be putting another set and I don't want it to take up too much space.

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[svgnames,table,xcdraw]{xcolor}
\usepackage[letterpaper, portrait, margin=2cm]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{pgfplots}
\usepackage{booktabs}
\definecolor{G1}{RGB}{198,224,180}
\definecolor{G2}{RGB}{226,239,218}
\definecolor{G3}{RGB}{112,173,71}

% snip
\part{Results}
\begin{tikzpicture}
\begin{axis}[
title={Standard Distillation},
xlabel={Amount Collected (ml)},
ylabel={Temperature (\celsius)},
xmin=0, xmax=26,
ymin=50, ymax=100,
legend pos=north west,
ymajorgrids=true,
xmajorgrids=true,
yminorgrids=true,
xminorgrids=true,
grid style=dashed,
]

color=blue,
mark=square,
]
coordinates {
(2,58)(4,60)(6,62)(8,63)(10,65)(12,65)(14,67)(16,69)(18,72)(20,75)(22,79)(24,88)(26,96)
};
\end{axis}
\end{tikzpicture}

% get table and chart same row, work on colour; stretching, fit above
\begin{table}[h!]
\setlength{\arrayrulewidth}{0.5mm}
{\rowcolors{3}{G1}{G2}
\begin{tabular}{|c|c|c|}
\hline
\multicolumn{2}{|c|}{Standard Distillation} \\
\hline
{\bf \cellcolor{G3}Amount Collected (ml)} & {\bf \cellcolor{G3}Temperature     (\celsius)} \\
\hline
2 & 58  \\
4 & 60  \\
6 & 62  \\
8 & 63  \\
\hline
\end{tabular}
}
\end{table}


Two options:

1. You can use two side-by-side minipages:

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[svgnames,table,xcdraw]{xcolor}
\usepackage[letterpaper, portrait, margin=2cm]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{pgfplots}
\usepackage{booktabs}
\definecolor{G1}{RGB}{198,224,180}
\definecolor{G2}{RGB}{226,239,218}
\definecolor{G3}{RGB}{112,173,71}

\def\celsius{}% just to make the code compilable

\begin{document}
\part{Results}

\noindent
\begin{minipage}{.5\textwidth}
\begin{tikzpicture}
\begin{axis}[
title={Standard Distillation},
xlabel={Amount Collected (ml)},
ylabel={Temperature (\celsius)},
xmin=0, xmax=26,
ymin=50, ymax=100,
legend pos=north west,
ymajorgrids=true,
xmajorgrids=true,
yminorgrids=true,
xminorgrids=true,
grid style=dashed,
]

color=blue,
mark=square,
]
coordinates {
(2,58)(4,60)(6,62)(8,63)(10,65)(12,65)(14,67)(16,69)(18,72)(20,75)(22,79)(24,88)(26,96)
};
\end{axis}
\end{tikzpicture}
\end{minipage}%
\begin{minipage}{.5\textwidth}
{\setlength{\arrayrulewidth}{0.5mm}
\rowcolors{3}{G1}{G2}
\begin{tabular}{|c|c|c|}
\hline
\multicolumn{2}{|c|}{Standard Distillation} \\
\hline
{\bf \cellcolor{G3}Amount Collected (ml)} & {\bf \cellcolor{G3}Temperature     (\celsius)} \\
\hline
2 & 58  \\
4 & 60  \\
6 & 62  \\
8 & 63  \\
\hline
\end{tabular}%
}%
\end{minipage}

\end{document}


2. You can use a tabular with baseline=(current bounding box.center) for the tikzpicture (as Torbjørn mentions in his comment, one can even remove the outer tabular):

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[svgnames,table,xcdraw]{xcolor}
\usepackage[letterpaper, portrait, margin=2cm]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{pgfplots}
\usepackage{booktabs}
\definecolor{G1}{RGB}{198,224,180}
\definecolor{G2}{RGB}{226,239,218}
\definecolor{G3}{RGB}{112,173,71}

\def\celsius{}

\begin{document}

\part{Results}

\noindent
\begin{tabular}{@{}cc@{}}
\begin{tikzpicture}[baseline=(current bounding box.center)]
\begin{axis}[
title={Standard Distillation},
xlabel={Amount Collected (ml)},
ylabel={Temperature (\celsius)},
xmin=0, xmax=26,
ymin=50, ymax=100,
legend pos=north west,
ymajorgrids=true,
xmajorgrids=true,
yminorgrids=true,
xminorgrids=true,
grid style=dashed,
]

color=blue,
mark=square,
]
coordinates {
(2,58)(4,60)(6,62)(8,63)(10,65)(12,65)(14,67)(16,69)(18,72)(20,75)(22,79)(24,88)(26,96)
};
\end{axis}
\end{tikzpicture}
&
\setlength{\arrayrulewidth}{0.5mm}
\rowcolors{3}{G1}{G2}
\begin{tabular}{|c|c|c|}
\hline
\multicolumn{2}{|c|}{Standard Distillation} \\
\hline
{\bf \cellcolor{G3}Amount Collected (ml)} & {\bf \cellcolor{G3}Temperature     (\celsius)} \\
\hline
2 & 58  \\
4 & 60  \\
6 & 62  \\
8 & 63  \\
\hline
\end{tabular}
\end{tabular}

\end{document}

• Which is the better way so to speak? I tried the second method first, got a "booboo" according to the error, but it allowed me to continue. Oct 2, 2015 at 2:54
• @JonWeinraub What do you mean with a "booboo"? My code doesn't produce errors. Both approaches are valid. In the second one you don't have to explicitly provide widths, as in the first one. Oct 2, 2015 at 2:56
• Sorry about the Celsius I think it is in \usepackage{gensymb} i took out a few things I thought to be unnecessary (from the title page) Oct 2, 2015 at 2:56
• Nevermind on the booboo, it was me. I kept the close table, I had more closes than opens. Thank you so much! Oct 2, 2015 at 3:00
• Simpler: remove the outer tabular altogether from the second suggestion. Oct 2, 2015 at 6:26