ElGato
22-05-2020, 03:37
Liebe Community,
seit Stunden versuche das Diagramm vollständig hinzubekommen.
Hans taucht leider nicht auf :( Wieso fehlt die der erste in der ersten Zeile?
\documentclass{scrbook}
\usepackage{xltxtra} % XeLaTeX
\usepackage{filecontents}
\usepackage{pgfplots,pgfplotstable}
\pgfplotsset{compat=1.4}
\usetikzlibrary{pgfplots.groupplots}
\begin{filecontents}{Woerter.dat}
Gruppe MW SD
Hans 2788.433 707.484260009309
Peter 3503.050 806.076
Sven 3697.500 368.310
Tim 3395.867 523.215
Max 3697.032 513.163
\end{filecontents}
\begin{filecontents}{Lieder.dat}
Gruppe MW SD
Hans 2700.667 634.761
Peter 1804.450 498.362
Sven 1815.200 368.310
Tim 2440.267 523.215
Max 2112.548 513.163
\end{filecontents}
\begin{filecontents}{Treffer.dat}
Gruppe MW SD
Hans 1.104 0.446
Peter 2.117 0.953
Sven 2.110 0.455
Tim 1.490 0.575
Max 1.861 0.576
\end{filecontents}
\begin{filecontents}{Ziele.dat}
Gruppe MW SD
Hans 10.6666666667 0.5773502692
Peter 10.6666666667 4.1633319989
Sven 8.6666666667 2.0816659995
Tim 8.3333333333 3.0550504633
Max 9 4.582575695
\end{filecontents}
\definecolor{Schwarz}{RGB}{0, 0, 0}
\definecolor{Grau1}{gray}{0.30}
\definecolor{Grau2}{gray}{0.60}
\definecolor{Grau3}{gray}{0.90}
\definecolor{Weiss}{RGB}{255, 255, 255}
\pgfplotscreateplotcyclelist{colorbrewer-Graustufen}{
{Schwarz!50!black,fill=Schwarz},
{Grau1!50!black,fill=Grau1},
{Grau2!50!black,fill=Grau2},
{Grau3!50!black,fill=Grau3},
{Weiss!50!black,fill=Weiss},
}
\pgfplotsset{
select row/.style={
x filter/.code={\ifnum\coordindex=#1\else\def\pgfmathresult {}\fi}
}
}
\begin{document}
\begin{figure}[hbt!]
\centering
\begin{tikzpicture}
\begin{groupplot}
[
group style={group size=2 by 2,ylabels at=edge left,horizontal sep=3cm,group name=plots},
height=6cm,
axis y line=left,ylabel near ticks,ymin=0,ybar,error bars/.cd,error bars/y explicit,error bars/y dir=plus,/pgf/bar shift=1pt,
%xtick=data,
xticklabels from table={Woerter.dat}{Gruppe},
%axis x line*=bottom,xtick=\empty,
cycle list name=colorbrewer-Graustufen,
%legend style={at={(0.75,-0.15)},draw=none,/tikz/every even column/.append style={column sep=5pt}},legend %columns=-1,
%legend image code/.code={\draw[#1] (0cm,-0.1cm) rectangle (0.5cm,0.1cm);}
]
\nextgroupplot[ymax=4500,ylabel=Lieder/Tag,bar width=20pt,legend to name=grouplegend]
\pgfplotsinvokeforeach {0,...,5}{
\addplot table [x=Gruppe, x expr=\coordindex, select row=#1, y=MW,y error=SD] {Woerter.dat};
}
\nextgroupplot[ymax=4500,ylabel=Tag/Tag,bar width=20pt]
\pgfplotsinvokeforeach {0,...,5}{
\addplot table [x expr=\coordindex, select row=#1, y=MW,y error=SD] {Lieder.dat};
}
\nextgroupplot[ymax=5,bar width=20pt]
\pgfplotsinvokeforeach {0,...,5}{
\addplot table [x expr=\coordindex, select row=#1, y=MW,y error=SD] {Treffer.dat};
}
\nextgroupplot[ymax=15,bar width=20pt]
\pgfplotsinvokeforeach {0,...,5}{
\addplot table [x expr=\coordindex, select row=#1, y=MW,y error=SD] {Ziele.dat};
%\addlegendentry {\pgfplotstablegetelem{#1}{Gruppe}\of{Woerter.dat} \pgfplotsretval}
}
\end{groupplot}
\node at (plots c2r1.south) [inner sep=0pt,anchor=north, yshift=-5ex] {\ref{grouplegend}};
\end{tikzpicture}
\end{figure}
\end{document}
6280
Über Hilfe bin ich sehr dankbar!
seit Stunden versuche das Diagramm vollständig hinzubekommen.
Hans taucht leider nicht auf :( Wieso fehlt die der erste in der ersten Zeile?
\documentclass{scrbook}
\usepackage{xltxtra} % XeLaTeX
\usepackage{filecontents}
\usepackage{pgfplots,pgfplotstable}
\pgfplotsset{compat=1.4}
\usetikzlibrary{pgfplots.groupplots}
\begin{filecontents}{Woerter.dat}
Gruppe MW SD
Hans 2788.433 707.484260009309
Peter 3503.050 806.076
Sven 3697.500 368.310
Tim 3395.867 523.215
Max 3697.032 513.163
\end{filecontents}
\begin{filecontents}{Lieder.dat}
Gruppe MW SD
Hans 2700.667 634.761
Peter 1804.450 498.362
Sven 1815.200 368.310
Tim 2440.267 523.215
Max 2112.548 513.163
\end{filecontents}
\begin{filecontents}{Treffer.dat}
Gruppe MW SD
Hans 1.104 0.446
Peter 2.117 0.953
Sven 2.110 0.455
Tim 1.490 0.575
Max 1.861 0.576
\end{filecontents}
\begin{filecontents}{Ziele.dat}
Gruppe MW SD
Hans 10.6666666667 0.5773502692
Peter 10.6666666667 4.1633319989
Sven 8.6666666667 2.0816659995
Tim 8.3333333333 3.0550504633
Max 9 4.582575695
\end{filecontents}
\definecolor{Schwarz}{RGB}{0, 0, 0}
\definecolor{Grau1}{gray}{0.30}
\definecolor{Grau2}{gray}{0.60}
\definecolor{Grau3}{gray}{0.90}
\definecolor{Weiss}{RGB}{255, 255, 255}
\pgfplotscreateplotcyclelist{colorbrewer-Graustufen}{
{Schwarz!50!black,fill=Schwarz},
{Grau1!50!black,fill=Grau1},
{Grau2!50!black,fill=Grau2},
{Grau3!50!black,fill=Grau3},
{Weiss!50!black,fill=Weiss},
}
\pgfplotsset{
select row/.style={
x filter/.code={\ifnum\coordindex=#1\else\def\pgfmathresult {}\fi}
}
}
\begin{document}
\begin{figure}[hbt!]
\centering
\begin{tikzpicture}
\begin{groupplot}
[
group style={group size=2 by 2,ylabels at=edge left,horizontal sep=3cm,group name=plots},
height=6cm,
axis y line=left,ylabel near ticks,ymin=0,ybar,error bars/.cd,error bars/y explicit,error bars/y dir=plus,/pgf/bar shift=1pt,
%xtick=data,
xticklabels from table={Woerter.dat}{Gruppe},
%axis x line*=bottom,xtick=\empty,
cycle list name=colorbrewer-Graustufen,
%legend style={at={(0.75,-0.15)},draw=none,/tikz/every even column/.append style={column sep=5pt}},legend %columns=-1,
%legend image code/.code={\draw[#1] (0cm,-0.1cm) rectangle (0.5cm,0.1cm);}
]
\nextgroupplot[ymax=4500,ylabel=Lieder/Tag,bar width=20pt,legend to name=grouplegend]
\pgfplotsinvokeforeach {0,...,5}{
\addplot table [x=Gruppe, x expr=\coordindex, select row=#1, y=MW,y error=SD] {Woerter.dat};
}
\nextgroupplot[ymax=4500,ylabel=Tag/Tag,bar width=20pt]
\pgfplotsinvokeforeach {0,...,5}{
\addplot table [x expr=\coordindex, select row=#1, y=MW,y error=SD] {Lieder.dat};
}
\nextgroupplot[ymax=5,bar width=20pt]
\pgfplotsinvokeforeach {0,...,5}{
\addplot table [x expr=\coordindex, select row=#1, y=MW,y error=SD] {Treffer.dat};
}
\nextgroupplot[ymax=15,bar width=20pt]
\pgfplotsinvokeforeach {0,...,5}{
\addplot table [x expr=\coordindex, select row=#1, y=MW,y error=SD] {Ziele.dat};
%\addlegendentry {\pgfplotstablegetelem{#1}{Gruppe}\of{Woerter.dat} \pgfplotsretval}
}
\end{groupplot}
\node at (plots c2r1.south) [inner sep=0pt,anchor=north, yshift=-5ex] {\ref{grouplegend}};
\end{tikzpicture}
\end{figure}
\end{document}
6280
Über Hilfe bin ich sehr dankbar!