bevor ich jetzt weitere Stunden damit verschwende meinen Code vernünftig ans laufen zu kriegen frage ich einfach mal hier.
Problem: Ich möchte innerhalb einer Groupplot-Umgebung einen weiteren Groupplot einfügen. Das Ganze soll dazu dienen, dass ich die Unterbrechung der y-Achse mittels axis y discontinuity=crunch für mehrere Bereiche nutzen kann!
Die einzelne Grafik habe ich bisher so erstellt:
\documentclass{standalone} \usepackage[]{siunitx} \usepackage{tikz,pgfplots} \pgfplotsset{compat=newest} \pgfplotsset{every axis plot/.append style={thick}} \usepgfplotslibrary{groupplots} \newcommand{\punktdicke}{2pt} \begin{document} \begin{tikzpicture}[] \begin{groupplot}[ group style={ group size=1 by 4, xlabels at=edge bottom, xticklabels at=edge bottom, vertical sep=0pt }, legend cell align=left, legend pos=north east, width=0.9\textwidth, xtick = {1,2,3,4,5,6,7,8,9,10}, xmin = 0.5, xmax = 10.5 ] \nextgroupplot[ height = 4cm, axis y discontinuity=crunch, ymin = 653, ymax=701, axis x line*=bottom,axis x line*=top, ] \addplot[mark = o, mark size = \punktdicke, blue] plot coordinates { (1,700) (2,670) (4,665) (5,661) (6,659) (7,656) (8,655) (9,654) (10,653) }; \coordinate (top) at (rel axis cs:0,1); \nextgroupplot[ height = 4cm, axis y discontinuity=crunch, ymin = 359, ymax=363, axis x line*=top,axis x line=none, ] \addplot[mark = o, mark size = \punktdicke, cyan] plot coordinates { (1.0000 ,362.959000) (2.0000 , 360.470000 ) (3.0000 ,360.469500 ) (4.0000 , 359.970000 ) (5.0000 ,360.466500) (6.0000 , 359.962000) (7.0000, 360.446500 ) (8.0000 , 360.467000 ) (9.0000 , 359.462000 ) (10.0000 , 359.984500) }; \nextgroupplot[ height = 4cm, ymin = 189, ymax=195 , axis y discontinuity=crunch, axis x line*=top,axis x line=none] \addplot[mark = o, mark size = \punktdicke, green] plot coordinates { (1.0000 ,192.352) (2.0000 , 190.35 ) (3.0000 ,190.847 ) (4.0000 , 190.3545 ) (5.0000 ,189.359) (6.0000 , 190.358) (7.0000, 189.3550 ) (8.0000 , 189.355 ) (9.0000 , 189.83 ) (10.0000 , 189.851) }; \nextgroupplot[ height = 4cm, ymin = 130, ymax=140, axis y discontinuity=crunch, axis x line*=top,axis x line*=bottom, xlabel = {Messung Nr. } ] \addplot[mark = o, mark size = \punktdicke,red] plot coordinates { (1.0000 , 135.3) (2.0000 , 133 ) (3.0000 , 132) (4.0000 , 133) (5.0000 ,132.3) (6.0000 , 133.3) (7.0000, 131.2 ) (8.0000 , 131.5 ) (9.0000 , 131.8 ) (10.0000 , 131.1) }; \coordinate (bot) at (rel axis cs:1,0); \end{groupplot} \path (top-|current bounding box.west)-- node[anchor=south,rotate=90] {\(H_\text{C}\ \left[G\right]\)} (bot-|current bounding box.west); \end{tikzpicture} \end{document}
Diese Darstellung soll in den folgenden Groupplot eingepflegt werden:
\documentclass{standalone} \usepackage[]{siunitx} \usepackage{tikz,pgfplots} \pgfplotsset{compat=newest} \pgfplotsset{every axis plot/.append style={ semithick}, legend pos={outer north east} } \usepgfplotslibrary{groupplots} \newcommand{\punktdicke}{2pt} \begin{document} \begin{tikzpicture}[] \pgfkeys{/pgf/number format/.cd,1000 sep={}} \begin{groupplot}[ group style={group size=3 by 2, horizontal sep=45pt, vertical sep=35pt}, width= 7cm, height = 7cm, xtick={1,2,...,10}] \nextgroupplot[ ylabel={\(H_\text{EB}\) [G]} ] \nextgroupplot[ylabel={\(H_\text{C}\) [G]}] \addplot[mark = o, mark size = \punktdicke, blue] plot coordinates { (1,700) (2,670) (4,665) (5,661) (6,659) (7,656) (8,655) (9,654) (10,653) }; \addplot[mark = o, mark size = \punktdicke, cyan] plot coordinates { (1.0000 ,362.959000) (2.0000 , 360.470000 ) (3.0000 ,360.469500 ) (4.0000 , 359.970000 ) (5.0000 ,360.466500) (6.0000 , 359.962000) (7.0000, 360.446500 ) (8.0000 , 360.467000 ) (9.0000 , 359.462000 ) (10.0000 , 359.984500) }; \addplot[mark = o, mark size = \punktdicke, green] plot coordinates { (1.0000 ,192.352) (2.0000 , 190.35 ) (3.0000 ,190.847 ) (4.0000 , 190.3545 ) (5.0000 ,189.359) (6.0000 , 190.358) (7.0000, 189.3550 ) (8.0000 , 189.355 ) (9.0000 , 189.83 ) (10.0000 , 189.851) }; \addplot[mark = o, mark size = \punktdicke,red] plot coordinates { (1.0000 , 135.3) (2.0000 , 133 ) (3.0000 , 132) (4.0000 , 133) (5.0000 ,132.3) (6.0000 , 133.3) (7.0000, 131.2 ) (8.0000 , 131.5 ) (9.0000 , 131.8 ) (10.0000 , 131.1) }; \nextgroupplot[ylabel={\(M \left(H_\text{EB}\right)\) [emu]} ] \nextgroupplot[ ylabel={\(H_\text{EB}\) [G]}, xlabel={Messung Nr. }, ] \nextgroupplot[ylabel={\(H_\text{C}\) [G]}, xlabel={Messung Nr. },] \addplot[mark = o, mark size = \punktdicke, blue] plot coordinates { (1,700) (2,670) (4,665) (5,661) (6,659) (7,656) (8,655) (9,654) (10,653) }; \addplot[mark = o, mark size = \punktdicke, cyan] plot coordinates { (1.0000 ,362.959000) (2.0000 , 360.470000 ) (3.0000 ,360.469500 ) (4.0000 , 359.970000 ) (5.0000 ,360.466500) (6.0000 , 359.962000) (7.0000, 360.446500 ) (8.0000 , 360.467000 ) (9.0000 , 359.462000 ) (10.0000 , 359.984500) }; \addplot[mark = o, mark size = \punktdicke, green] plot coordinates { (1.0000 ,192.352) (2.0000 , 190.35 ) (3.0000 ,190.847 ) (4.0000 , 190.3545 ) (5.0000 ,189.359) (6.0000 , 190.358) (7.0000, 189.3550 ) (8.0000 , 189.355 ) (9.0000 , 189.83 ) (10.0000 , 189.851) }; \addplot[mark = o, mark size = \punktdicke,red] plot coordinates { (1.0000 , 135.3) (2.0000 , 133 ) (3.0000 , 132) (4.0000 , 133) (5.0000 ,132.3) (6.0000 , 133.3) (7.0000, 131.2 ) (8.0000 , 131.5 ) (9.0000 , 131.8 ) (10.0000 , 131.1) }; \nextgroupplot[ylabel={\(M \left(H_\text{EB}\right)\) [emu]}, xlabel={Messung Nr.}, ] \end{groupplot} \end{tikzpicture} \end{document}
Das Problem ist, dass es scheinbar nicht möglich ist, den Groupplot verschachtelt zu machen. Also innerhalb einer Groupplot-Umgebung eine weitere zu eröffnen.
Hat jemand eine Idee wie man das Problem lösen kann? Ich habe auf anderen Seiten auch Lösungen gefunden, bei denen die Unterbrechung der y-Achse nur mit der Axis Umgebung gelöst wird - das hilft hier aber leider auch nicht.
Ich freue mich auf Lösungsvorschläge und stehe für Rückfragen gerne zur Verfügung.