# tikz graph in tabular

Καλησπέρα!

I 'm trying to put graphs that are made by tikz in a tabular, but:

1. the size of the graph is too big for the table,
2. I 'm wondering if in not "safe" to combine tabular and tikzpicture environments.

For the problem (1): I tried to scale the graph, but also shrink the letters (e.g. x label).

The code:

\documentclass{article}
\usepackage{tikz,pgfplots}
\usepackage{multicol}
\begin{document}

\begin{tabular}{|c|c|}
\hline
\multicolumn{2}{|c|}{$f(x)=\alpha x^2$}\\
\hline
\begin{tikzpicture}[>=latex]
\begin{axis}[
ticks=none,
axis x line=center,
axis y line=center,
xlabel={$x$},
ylabel={$y$},
xlabel style={below right},
ylabel style={above left},
xmin=-2,
xmax=2,
ymin=-0.5,
ymax=3]
\addplot [domain=-2:2,ultra thick] {0.7*x^2} node [pos=0.9, below right] {$C_f$};
\end{axis}
\node at (0.5,-0.2,1) {{$\alpha>0$}};
\end{tikzpicture}
&
\begin{tikzpicture}[>=latex]
\begin{axis}[
ticks=none,
axis x line=center,
axis y line=center,
xlabel={$x$},
ylabel={$y$},
xlabel style={below right},
ylabel style={above left},
xmin=-2,
xmax=2,
ymin=-3,
ymax=0.5]
\addplot [domain=-2:2,ultra thick] {-0.7*x^2} node [pos=0.9, above right] {$C_f$};
\end{axis}
\node at (0.5,-0.2,1) {{$\alpha<0$}};
\end{tikzpicture}\\
\hline
\end{tabular}

\end{document}


Ευχαριστώ εκ των προτέρων!

• Your code contains characters that I can not copy into my editor. Apart from that, you can use tikzpictures in tables. However, I removed the special characters, and what I got was something that sort of cried for being typeset with groupplots that come with pgfplots. There you can just fix the width of the plots and do not run into the problem. – user121799 Dec 11 '18 at 20:26
• Thank you! I 'm sorry for the greek letters (Η συνάρτηση), I didn't notice that I haven't remove them. I 'll do it right now. By fixing the width of the plot all be OK! Thank's! – Kώστας Κούδας Dec 12 '18 at 7:04

i would define graphs' size in dependence to the available table space width. for this i would use usetabular table environment:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\begin{center}
\pgfplotsset{width=0.9\linewidth,
scale only axis,
axis lines = middle,
ticks=none,
xlabel={$x$},
ylabel={$y$},
xlabel style={right},
ylabel style={above},
xmin=-2,
xmax=2,
%
every axis plot post/.append style={ultra thick, smooth},
}
\begin{tabularx}{\linewidth}{|C|C|}
\hline
\multicolumn{2}{|c|}{$f(x)=\alpha x^2$}\\
\hline
\begin{tikzpicture}
\begin{axis}[ymin=-0.5, ymax=3]
\addplot [domain=-2:2] {0.7*x^2} node [pos=0.9, below right] {$C_f$};
\end{axis}
\node at (0.5,-0.2) {$\alpha>0$};
\end{tikzpicture}
&
\begin{tikzpicture}
\begin{axis}[ymin=-3, ymax=0.5]
\addplot [domain=-2:2] {-0.7*x^2} node [pos=0.9, above right] {$C_f$};
\end{axis}
\node at (0.5,-0.2) {{$\alpha<0$}};
\end{tikzpicture}\\
\hline
\end{tabularx}
\end{center}
\end{document}


(red lines indicate page layout)