von Udo » Mo 13. Mär 2017, 11:55
Hallo,
ich möchte mit dem Paket "subcaption" zwei pgfplots nebeneinander setzen.
Wenn ich das mache:
\documentclass{article}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{subcaption}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{figure}[!htb]
\centering
\subcaptionbox{Bild1\label{bild1}}{%
\begin{tikzpicture}
\begin{axis}[enlargelimits=0.2]
\addplot+[nodes near coords,only marks,point meta=explicit symbolic] table[meta=label] {
x y label
0.5 0.2 1
0.2 0.1 t2
0.7 0.6 3
0.35 0.4 Y4
0.65 0.1 5
};
\end{axis}
\end{tikzpicture}
}%
\subcaptionbox{Bild2\label{bild2}}{%
\begin{tikzpicture}
\begin{axis}[enlargelimits=0.2]
\addplot+[nodes near coords,only marks,point meta=explicit symbolic] table[meta=label] {
x y label
0.5 0.2 1
0.2 0.1 t2
0.7 0.6 3
0.35 0.4 Y4
0.65 0.1 5
};
\end{axis}
\end{tikzpicture}
}%
\caption{TestCap}
\end{figure}
\end{document}
kommt der Fehler:
Package pgfplots Error: Could not read table file '" x y label 0 .5 0.2 1 0.2 0.1 t2 0.7 0.6 3 0.35 0.4 Y4 0.65 0.1 5 "' in 'search path=.'. In case you intended to provide inline data: maybe TeX screwed up your end-of-line s? Try `row sep=crcr' and terminate your lines with `\\' (refer to the pgfplots table manual for details).
Das merkwürdige ist, dass die beiden pgfplots aus der Doku sind und ohne subcaption auch problemlos laufen. Kommentiert man also die zwei Zeilen mit subcaptionbox und der schließenden Klammer aus, funktioniert es:
\documentclass{article}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{subcaption}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{figure}[!htb]
\centering
%\subcaptionbox{Bild1\label{bild1}}{%
\begin{tikzpicture}
\begin{axis}[enlargelimits=0.2]
\addplot+[nodes near coords,only marks,point meta=explicit symbolic] table[meta=label] {
x y label
0.5 0.2 1
0.2 0.1 t2
0.7 0.6 3
0.35 0.4 Y4
0.65 0.1 5
};
\end{axis}
\end{tikzpicture}
%}%
%\subcaptionbox{Bild2\label{bild2}}{%
\begin{tikzpicture}
\begin{axis}[enlargelimits=0.2]
\addplot+[nodes near coords,only marks,point meta=explicit symbolic] table[meta=label] {
x y label
0.5 0.2 1
0.2 0.1 t2
0.7 0.6 3
0.35 0.4 Y4
0.65 0.1 5
};
\end{axis}
\end{tikzpicture}
%}%
\caption{TestCap}
\end{figure}
\end{document}
Weiß jemand, warum das so ist?
Gruß Udo
Hallo,
ich möchte mit dem Paket "subcaption" zwei pgfplots nebeneinander setzen.
Wenn ich das mache:
[code]
\documentclass{article}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{subcaption}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{figure}[!htb]
\centering
\subcaptionbox{Bild1\label{bild1}}{%
\begin{tikzpicture}
\begin{axis}[enlargelimits=0.2]
\addplot+[nodes near coords,only marks,point meta=explicit symbolic] table[meta=label] {
x y label
0.5 0.2 1
0.2 0.1 t2
0.7 0.6 3
0.35 0.4 Y4
0.65 0.1 5
};
\end{axis}
\end{tikzpicture}
}%
\subcaptionbox{Bild2\label{bild2}}{%
\begin{tikzpicture}
\begin{axis}[enlargelimits=0.2]
\addplot+[nodes near coords,only marks,point meta=explicit symbolic] table[meta=label] {
x y label
0.5 0.2 1
0.2 0.1 t2
0.7 0.6 3
0.35 0.4 Y4
0.65 0.1 5
};
\end{axis}
\end{tikzpicture}
}%
\caption{TestCap}
\end{figure}
\end{document}[/code]
kommt der Fehler:
[code]
Package pgfplots Error: Could not read table file '" x y label 0 .5 0.2 1 0.2 0.1 t2 0.7 0.6 3 0.35 0.4 Y4 0.65 0.1 5 "' in 'search path=.'. In case you intended to provide inline data: maybe TeX screwed up your end-of-line s? Try `row sep=crcr' and terminate your lines with `\\' (refer to the pgfplots table manual for details). [/code]
Das merkwürdige ist, dass die beiden pgfplots aus der Doku sind und ohne subcaption auch problemlos laufen. Kommentiert man also die zwei Zeilen mit subcaptionbox und der schließenden Klammer aus, funktioniert es:
[code]
\documentclass{article}
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage{subcaption}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{figure}[!htb]
\centering
%\subcaptionbox{Bild1\label{bild1}}{%
\begin{tikzpicture}
\begin{axis}[enlargelimits=0.2]
\addplot+[nodes near coords,only marks,point meta=explicit symbolic] table[meta=label] {
x y label
0.5 0.2 1
0.2 0.1 t2
0.7 0.6 3
0.35 0.4 Y4
0.65 0.1 5
};
\end{axis}
\end{tikzpicture}
%}%
%\subcaptionbox{Bild2\label{bild2}}{%
\begin{tikzpicture}
\begin{axis}[enlargelimits=0.2]
\addplot+[nodes near coords,only marks,point meta=explicit symbolic] table[meta=label] {
x y label
0.5 0.2 1
0.2 0.1 t2
0.7 0.6 3
0.35 0.4 Y4
0.65 0.1 5
};
\end{axis}
\end{tikzpicture}
%}%
\caption{TestCap}
\end{figure}
\end{document}[/code]
Weiß jemand, warum das so ist?
Gruß Udo