I'm having trouble with the vertical alignment of the nodes in a tikz matrix. I have two plots next to each other. I want them to be aligned with respect to the center of their bounding boxes, but they end up aligned with respect to the zero coordinate (the abscissa in this case). Based on other questions (e.g., Aligning matrix nodes in tikz), I've tried with various combinations of align=base
, align=center
, anchor=center
, etc, without success.
Below is the code and corresponding output.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{figure}[h!]
\centering
\begin{tikzpicture}
\matrix [column sep=1cm, row sep=1cm, cells={xscale=0.7, yscale=2},
align=center, nodes={rectangle, anchor=center, align=center}]
{
\draw [->] (-4.2,0) -- (4.2,0);
\draw [->] (0,0) -- (0,1.3);
\draw [blue, ultra thick, domain=-4:4, samples=100] plot
(\x, {1/sqrt(1 + \x*\x)});
&
\draw [->] (-4.2,0) -- (4.2,0);
\draw [->] (0,-0.6) -- (0,0.6);
\draw [blue, ultra thick, domain=-4:4, samples=100] plot
(\x, {-0.4*pi*atan(\x)/180});
\\
};
\end{tikzpicture}
\caption{How to align?}
\end{figure}
\end{document}
Any idea about how to vertically align the center of the cell's bounding boxes?
\makebox
separated by a\qquad
space.