I'm trying to have a table generated by the tabular environment and a plot generated by TikZ placed side by side. I tried using the table and minipage environment since it works for having multiple tables side by side. However the two objects seems to be off vertically, what am I doing wrong?
\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{gensymb}
\usepackage{pgfplots}
\begin{document}
\begin{table}
\begin{minipage}[b]{5 cm}
\centering
\begin{tabular}{|c|c|}
\hline
Temperature & IQ Score \\ \hline
14\celsius & 57\% \\ \hline
16\celsius & 65\% \\ \hline
18\celsius & 69\% \\ \hline
20\celsius & 71\% \\ \hline
22\celsius & 79\% \\ \hline
24\celsius & 88\% \\ \hline
26\celsius & 81\% \\ \hline
28\celsius & 76\% \\ \hline
30\celsius & 66\% \\ \hline
32\celsius & 62\% \\
\hline
\end{tabular}
\end{minipage}
\hspace{1cm}
\begin{minipage}[b]{10cm}
\centering
\begin{tikzpicture}
\begin{axis}[grid=major, grid style={dashed,gray!30}, xlabel=Temperature $\celsius$,ylabel=IQ Scores \%, legend style={at={(axis cs:25,28)},anchor=south}]
%\addplot[scatter, only marks, scatter/classes={y={black}}] table[x=x, y=y, col sep=comma] {NumbersAndFunctions-Temp-IQ-data.csv};
\addplot[color=red, domain=7:41, thick, samples=400, mark=none] {88*exp(-(\x-24)^2/253.0889)};
\legend{Raw, Gaussian};
\end{axis}
\end{tikzpicture}
\end{minipage}
\end{table}
\end{document}
Thanks
Best Answer
These are aligned at the top:
With no
[t]
inminipage
and[baseline={(current bounding box.center)}]
intikzpicture
they are aligned at the center.With no
[b
] in bothtabular
andminipage
and[baseline={(current bounding box.south)}]
intikzpicture
they are aligned at the bottom.