von Kalle754 » So 27. Jul 2014, 21:30
Ich habe folgendes Problem ich habe mir Plots erstellt, in dem ich mehrere Tikzpicture untereinander in eine figure Umgebung gepackt habe. Nur das unterste Diagramm hat eine x Achse. Ist villt nicht die eleganteste Lösung, aber das ist nicht mein Problem.
Sondern die Plots sind teilweise versetzt. Meistens nur der letzte und manchmal geht es und manchmal nicht.
Ich habe mal ein Minimalbeispiel erstellt. Normalerweise füge ich die tikzpicture durch input in der figure Umgebung ein.
Unten habe ich es einmal ohne input gemacht, dann funktioniert es plötzlich.
Wie mache ich das mit Input?
\documentclass[a4paper,12pt,oneside,headings=normal,liststotoc]{scrbook}
\usepackage[latin1]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage[onehalfspacing]{setspace}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pgfplotstable} %Regression
\usepackage{units}
\usepackage{longtable}
\usepackage{bibgerm}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{multirow}
\usepackage{float} %Zum Platzieren der Grafik an der richtigen Stelle
\usepackage{booktabs}
\usepackage[hidelinks]{hyperref}
\usepackage{scrpage2}%Kopf&Fußzeile
\usepackage[a4paper,left=4cm,right=3cm,top=2.5cm,bottom=2.5cm,includeheadfoot,ignorefoot]{geometry}
\usepackage[backend=bibtex,style=alphabetic]{biblatex}
%\pgfplotsset{compat=newest} %Plotwarnung
\pgfplotsset{compat=newest,
trim axis left,
scale only axis
}
\begin{document}
%Inhalt der Arbeit
\chapter{hallo}
Hallo das ist ein Minimalbeispiel.
\begin{figure}[ht]
\centering
\input{test}
\caption{Nicht optimierter Verlauf}
\label{nichtoptimiert}
\end{figure}
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[width=0.75\textwidth,
height=3.5cm,
grid=major,
ymin=0,ymax=16,
xmin=0, xmax=54,
xticklabels={},
ylabel={\%},
legend pos= north east]
\legend{Gaspedalstellung}
\addplot[mark=none]coordinates {
( 338.1, 266.45 ) ( 169.1, 143.43 ) ( 84.5, 64.80 ) ( 42.3, 34.19 )
};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[width=0.75\textwidth,
height=3.5cm,
grid=major,
ymin=0, %ymax=55,
xmin=0, xmax=54,
xticklabels={},
ylabel={$bar$},
legend pos= north east]
\addplot[mark=none]coordinates {
( 338.1, 266.45 ) ( 169.1, 143.43 ) ( 84.5, 64.80 ) ( 42.3, 34.19 ) (21.1, 9.47)
};
\legend{Tankdruck}
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[width=0.75\textwidth,
height=3.5cm,
grid=major,
ymin=0, %ymax=55,
xmin=0, xmax=54,
xticklabels={},
ylabel={$bar$},
legend pos= north east]
\addplot[mark=none]coordinates {
( 338.1, 266.45 ) ( 169.1, 143.43 ) ( 84.5, 64.80 ) ( 42.3, 34.19 ) (21.1, 9.47)
};
\legend{Tankdruck}
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[width=0.75\textwidth,
height=3.5cm,
grid=major,
ymin=0.7,
xmin=0, xmax=54,
xlabel={Sekunden},
ylabel={Event},
legend pos= north east]
\legend{Event}
\addplot[mark=none]coordinates {
( 338.1, 266.45 ) ( 84.5, 64.80 ) ( 42.3, 34.19 ) (21.1, 9.47)
};
\end{axis}
\end{tikzpicture}
\end{figure}
text
\chapter{test}
\end{document}
Ich habe folgendes Problem ich habe mir Plots erstellt, in dem ich mehrere Tikzpicture untereinander in eine figure Umgebung gepackt habe. Nur das unterste Diagramm hat eine x Achse. Ist villt nicht die eleganteste Lösung, aber das ist nicht mein Problem.
Sondern die Plots sind teilweise versetzt. Meistens nur der letzte und manchmal geht es und manchmal nicht.
Ich habe mal ein Minimalbeispiel erstellt. Normalerweise füge ich die tikzpicture durch input in der figure Umgebung ein.
Unten habe ich es einmal ohne input gemacht, dann funktioniert es plötzlich.
Wie mache ich das mit Input?
[code]
\documentclass[a4paper,12pt,oneside,headings=normal,liststotoc]{scrbook}
\usepackage[latin1]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage[onehalfspacing]{setspace}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pgfplotstable} %Regression
\usepackage{units}
\usepackage{longtable}
\usepackage{bibgerm}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{multirow}
\usepackage{float} %Zum Platzieren der Grafik an der richtigen Stelle
\usepackage{booktabs}
\usepackage[hidelinks]{hyperref}
\usepackage{scrpage2}%Kopf&Fußzeile
\usepackage[a4paper,left=4cm,right=3cm,top=2.5cm,bottom=2.5cm,includeheadfoot,ignorefoot]{geometry}
\usepackage[backend=bibtex,style=alphabetic]{biblatex}
%\pgfplotsset{compat=newest} %Plotwarnung
\pgfplotsset{compat=newest,
trim axis left,
scale only axis
}
\begin{document}
%Inhalt der Arbeit
\chapter{hallo}
Hallo das ist ein Minimalbeispiel.
\begin{figure}[ht]
\centering
\input{test}
\caption{Nicht optimierter Verlauf}
\label{nichtoptimiert}
\end{figure}
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[width=0.75\textwidth,
height=3.5cm,
grid=major,
ymin=0,ymax=16,
xmin=0, xmax=54,
xticklabels={},
ylabel={\%},
legend pos= north east]
\legend{Gaspedalstellung}
\addplot[mark=none]coordinates {
( 338.1, 266.45 ) ( 169.1, 143.43 ) ( 84.5, 64.80 ) ( 42.3, 34.19 )
};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[width=0.75\textwidth,
height=3.5cm,
grid=major,
ymin=0, %ymax=55,
xmin=0, xmax=54,
xticklabels={},
ylabel={$bar$},
legend pos= north east]
\addplot[mark=none]coordinates {
( 338.1, 266.45 ) ( 169.1, 143.43 ) ( 84.5, 64.80 ) ( 42.3, 34.19 ) (21.1, 9.47)
};
\legend{Tankdruck}
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[width=0.75\textwidth,
height=3.5cm,
grid=major,
ymin=0, %ymax=55,
xmin=0, xmax=54,
xticklabels={},
ylabel={$bar$},
legend pos= north east]
\addplot[mark=none]coordinates {
( 338.1, 266.45 ) ( 169.1, 143.43 ) ( 84.5, 64.80 ) ( 42.3, 34.19 ) (21.1, 9.47)
};
\legend{Tankdruck}
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[width=0.75\textwidth,
height=3.5cm,
grid=major,
ymin=0.7,
xmin=0, xmax=54,
xlabel={Sekunden},
ylabel={Event},
legend pos= north east]
\legend{Event}
\addplot[mark=none]coordinates {
( 338.1, 266.45 ) ( 84.5, 64.80 ) ( 42.3, 34.19 ) (21.1, 9.47)
};
\end{axis}
\end{tikzpicture}
\end{figure}
text
\chapter{test}
\end{document}
[/code]