von axu » Mo 14. Nov 2016, 13:31
Hallo,
ich würde gerne die Fläche zwischen zwei Kurven füllen. Leider klappt das bei mir nicht.
Hier mal das Minimalbesipiel
\documentclass[a4paper]{article}
\begin{filecontents}{Data.csv}
eins;zwei;drei;vier;fuenf;sechs
0.000;0.000;0.000;0.000;0.000;0.000
-0.002;0.014;0.147;-0.600;55.961;11.413
-0.004;0.022;0.165;-0.598;50.177;10.872
-0.010;0.092;0.200;-0.592;46.976;9.818
-0.012;0.110;0.208;-0.590;45.910;9.447
-0.014;0.124;0.236;-0.588;44.846;9.250
-0.020;0.151;0.295;-0.582;41.666;8.689
\end{filecontents}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot
table[name path=A, mark=none,x expr=\thisrowno{0}, y expr=(\thisrowno{1}-\thisrowno{2})*-1, header=true, col sep=semicolon] {data.csv};
\addplot
table[name path=B, mark=none,x expr=\thisrowno{0}, y expr=(\thisrowno{1}+\thisrowno{2})*-1, header=true, col sep=semicolon] {data.csv};
\addplot[blue!50] fill between[of=A and B];
\end{axis}
\end{tikzpicture}
\end{document}
LaTeX bricht mit einigen Fehler ab. Wenn die Zeile mit "fill between" auskommentiert ist, werden zumindest die Graphen richtig geplottet.
Über eine Hilfestellung wäre ich sehr dankbar.
Hallo,
ich würde gerne die Fläche zwischen zwei Kurven füllen. Leider klappt das bei mir nicht.
Hier mal das Minimalbesipiel
[code]\documentclass[a4paper]{article}
\begin{filecontents}{Data.csv}
eins;zwei;drei;vier;fuenf;sechs
0.000;0.000;0.000;0.000;0.000;0.000
-0.002;0.014;0.147;-0.600;55.961;11.413
-0.004;0.022;0.165;-0.598;50.177;10.872
-0.010;0.092;0.200;-0.592;46.976;9.818
-0.012;0.110;0.208;-0.590;45.910;9.447
-0.014;0.124;0.236;-0.588;44.846;9.250
-0.020;0.151;0.295;-0.582;41.666;8.689
\end{filecontents}
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot
table[name path=A, mark=none,x expr=\thisrowno{0}, y expr=(\thisrowno{1}-\thisrowno{2})*-1, header=true, col sep=semicolon] {data.csv};
\addplot
table[name path=B, mark=none,x expr=\thisrowno{0}, y expr=(\thisrowno{1}+\thisrowno{2})*-1, header=true, col sep=semicolon] {data.csv};
\addplot[blue!50] fill between[of=A and B];
\end{axis}
\end{tikzpicture}
\end{document}[/code]
LaTeX bricht mit einigen Fehler ab. Wenn die Zeile mit "fill between" auskommentiert ist, werden zumindest die Graphen richtig geplottet.
Über eine Hilfestellung wäre ich sehr dankbar.