[Tex/LaTex] Create groupplot 3 x 6

groupplotspgfplotstikz-pgf

I asked a similar question before: Create 2×2 groupplot with +1 plot to the side?

For that time using the subfigure environment wasn't a problem. But I do not want to use the subfigure environment now, so I am looking for a different solution. The plot I want to create is:

|-----------------|
|        | Plot 4 |
| Plot 1 |--------| 
|        | Plot 5 |
|-----------------|
|        | Plot 6 |
| Plot 2 |--------| 
|        | Plot 7 |
|-----------------|
|        | Plot 8 |
| Plot 3 |--------| 
|        | Plot 9 |
|-----------------|

Plot 1,2,3 have namely the same x-axis (and for those interested it is a impulse response plot), as well as the plots 4,..,9 (which are bode plots, magnitude + phase).

Does anyone have any idea? I think groupplots should be extend to have some tabular capabilities.

If you are looking for a minimal example I don't have really one since I do not know how to create this but the code of the solution of my previous question might get you started, https://tex.stackexchange.com/a/117685/15360

ps. btw the solution does not necessarly have to be using the groupplot environment. The main reason I use groupplot very often because I know then that the alignment is good. Also when you show the x- and ylabels aswell as the ticks of x and y. So it is meanly about that the alignment is correct.

Best Answer

You could use two groupplots environments, where the height of the axes in the second is half that of the first. To align them properly I placed the first sub-plot of the second groupplot relative to the first groupplot, with

\nextgroupplot[anchor=north west, at={($(left plots c1r1.north east) + (0.2cm,0)$)}]

left plots is a label for the first groupplot, added with

group style={
   group name=left plots,
   ..
   }

and left plots c1r1 is the axis that is in the first column and first row of the group.

I used the ($(a) + (b)$) syntax from the calc library as ([xshift=0.2cm]left plots c1r1.north east) didn't work.

enter image description here

\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\usetikzlibrary{calc}
\begin{document}

\begin{tikzpicture}
\begin{groupplot}[
   group style={
      group name=left plots,
      group size=1 by 3,
      vertical sep=0pt,
      x descriptions at=edge bottom},
   width=4cm,
   height=4cm,
   scale only axis]
\nextgroupplot
 \addplot {x^2};
\nextgroupplot
 \addplot {x^2};
 \nextgroupplot
 \addplot {x^2};
\end{groupplot}

\begin{groupplot}[
    group style={
       group size=1 by 6,
       vertical sep=0pt,
       x descriptions at=edge bottom},
    width=4cm,
    height=2cm,
    scale only axis,
    ytick pos=right]
\nextgroupplot[anchor=north west, at={($(left plots c1r1.north east) + (0.2cm,0)$)}]
 \addplot {sqrt(x)};
\nextgroupplot
 \addplot {sqrt(x)};
 \nextgroupplot
 \addplot {sqrt(x)};
\nextgroupplot
 \addplot {sqrt(x)};
\nextgroupplot
 \addplot {sqrt(x)};
 \nextgroupplot
 \addplot {sqrt(x};
\end{groupplot}
\end{tikzpicture}

\end{document}

Old answer

I would like a groupplots only solution, but a workaround is to use two tikzpictures each having a groupplot environment, where the height of the axes in the second is half the height of those in the first.

\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\begin{document}

\begin{tikzpicture}
\begin{groupplot}[
   group style={
      group size=1 by 3,
      vertical sep=0pt,
      x descriptions at=edge bottom},
   width=4cm,
   height=4cm,
   scale only axis]
\nextgroupplot
 \addplot {x^2};
\nextgroupplot
 \addplot {x^2};
 \nextgroupplot
 \addplot {x^2};
\end{groupplot}
\end{tikzpicture}
%
\begin{tikzpicture}
\begin{groupplot}[
    group style={
       group size=1 by 6,
       vertical sep=0pt,
       x descriptions at=edge bottom},
    width=4cm,
    height=2cm,
    scale only axis,
    ytick pos=right]
\nextgroupplot
 \addplot {sqrt(x)};
\nextgroupplot
 \addplot {sqrt(x)};
 \nextgroupplot
 \addplot {sqrt(x)};
\nextgroupplot
 \addplot {sqrt(x)};
\nextgroupplot
 \addplot {sqrt(x)};
 \nextgroupplot
 \addplot {sqrt(x};
\end{groupplot}
\end{tikzpicture}

\end{document}

enter image description here

Related Question