I want to center two tikzpictures which are both in a own subfloat on a landscape page. With my example code the begin of the second timeline is shifted. You can see the shift in the picture. I want to have the beginnigs of the two timelines on the same horizontal line.
\documentclass[a4paper,11pt,smallchapters,blue,extramargin,lnum]{article}
\usepackage{lscape}
\usepackage{subfig}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{landscape}
\vspace*{\fill}
\begin{figure}[h]
\begin{center}
\subfloat[Situation 1 \label{fig:situationen-2.impl-exp3:situation1}] {
\begin{tikzpicture}
% draw horizontal line
\draw (0,0) -- (15,0);
% draw vertical lines
\foreach \x in {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
\draw (\x cm,3pt) -- (\x cm,-3pt);
% draw nodes
\draw (0,0) node[below=3pt] {$ 0s $} node[above=15pt] {Raspberry Pi} node[above=1pt] {sendet};
\draw (10,0) node[below=3pt] {$ 50s $} node[above=12pt] {Beginn} node[above=1pt] {Zustandswechsel};
\draw (15,0) node[below=3pt] {$ 150s $} node[above=3pt] {Ende};
\end{tikzpicture}
}
\newline
\subfloat[Situation 2 \label{fig:situationen-2.impl-exp3:situation2}] {
\begin{tikzpicture}
% draw horizontal line
\draw (0,0) -- (15,0);
% draw vertical lines
\foreach \x in {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
\draw (\x cm,3pt) -- (\x cm,-3pt);
% draw nodes
\draw (0,0) node[below=3pt] {$ 0s $} node[above=15pt] {Raspberry Pi} node[above=1pt] {sendet};
\draw (5,0) node[below=3pt] {$ 50s $} node[above=12pt] {Beginn} node[above=1pt] {Zustandswechsel};
\draw (10,0) node[below=3pt] {$ 100s $} node[above=12pt] {Senderate} node[above=1pt] {kleiner};
\draw (15,0) node[below=3pt] {$ 150s $} node[above=3pt] {Ende};
\end{tikzpicture}
}
\caption{Untersuchte Situationen in Experiment 3 der 2.Implementierung} \label{fig:situationen-2.impl-exp2}
\end{center}
\end{figure}
\vspace*{\fill}
\end{landscape}
\end{document}
The problem is caused by the combination of centred text and the forced line break from \newline
. You can avoid this by simply leaving an empty line to start a new paragraph:
\documentclass[a4paper,11pt,smallchapters,blue,extramargin,lnum]{article}
\usepackage{lscape}
\usepackage{subfig}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{landscape}
\vspace*{\fill}
\begin{figure}[h]
\centering
% \begin{center}
\subfloat[Situation 1 \label{fig:situationen-2.impl-exp3:situation1}] {
\begin{tikzpicture}
% draw horizontal line
\draw (0,0) -- (15,0);
% draw vertical lines
\foreach \x in {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
\draw (\x cm,3pt) -- (\x cm,-3pt);
% draw nodes
\draw (0,0) node[below=3pt] {$ 0s $} node[above=15pt] {Raspberry Pi} node[above=1pt] {sendet};
\draw (10,0) node[below=3pt] {$ 50s $} node[above=12pt] {Beginn} node[above=1pt] {Zustandswechsel};
\draw (15,0) node[below=3pt] {$ 150s $} node[above=3pt] {Ende};
\end{tikzpicture}
}
\subfloat[Situation 2 \label{fig:situationen-2.impl-exp3:situation2}] {
\begin{tikzpicture}
% draw horizontal line
\draw (0,0) -- (15,0);
% draw vertical lines
\foreach \x in {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
\draw (\x cm,3pt) -- (\x cm,-3pt);
% draw nodes
\draw (0,0) node[below=3pt] {$ 0s $} node[above=15pt] {Raspberry Pi} node[above=1pt] {sendet};
\draw (5,0) node[below=3pt] {$ 50s $} node[above=12pt] {Beginn} node[above=1pt] {Zustandswechsel};
\draw (10,0) node[below=3pt] {$ 100s $} node[above=12pt] {Senderate} node[above=1pt] {kleiner};
\draw (15,0) node[below=3pt] {$ 150s $} node[above=3pt] {Ende};
\end{tikzpicture}
}
\caption{Untersuchte Situationen in Experiment 3 der 2.Implementierung} \label{fig:situationen-2.impl-exp2}
% \end{center}
\end{figure}
\vspace*{\fill}
\end{landscape}
\end{document}
(I'm using \centering
instead of the center
environment to avoid additional vertical spacing, but for your use case that's not really important)