1

What I am looking for is something like this: enter image description here

and I have tried the next MWE:

\documentclass[10pt,a4paper]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\begin{document}    
\begin{figure}
  \begin{tikzpicture}
     \begin{groupplot}[
         group style={group size=2 by 2},
         cycle multiindex* list = {very thick\nextlist red\nextlist 
         only 
         marks\nextlist}
     ] 
     \nextgroupplot \addplot {x}; \addplot {x^2};
     \nextgroupplot[cycle list = {red, blue}] \addplot {x}; \addplot 
     {x^2};
     \nextgroupplot \addplot[green] {x}; \addplot {x^2};
     \nextgrouplot %Here I am not sure what to do
        \begin{groupplot}[
                            group style={group size=2 by 2},
                            cycle multiindex* list = {very 
                            thick\nextlist red\nextlist only 
                           marks\nextlist}
                           ]
           \nextgroupplot \addplot {x}; \addplot {x^2};
           \nextgroupplot \addplot {x}; \addplot {x^2};
           \nextgroupplot \addplot {x}; \addplot {x^2};
           \nextgroupplot \addplot {x}; \addplot {x^2};
       \end{groupplot}
     \end{groupplot}
   \end{tikzpicture}
 \end{figure}
\end{document}
2

A quick and ugly solution, use a scope around the second groupplot

\documentclass[10pt,a4paper,tikz]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\begin{document}    
  \begin{tikzpicture}
     \begin{groupplot}[
        at={(0,0)},
         group style={group size=2 by 2},
         cycle multiindex* list = {very thick\nextlist red\nextlist 
         only 
         marks\nextlist}
     ] 
     \nextgroupplot \addplot {x}; \addplot {x^2};
     \nextgroupplot[cycle list = {red, blue}] \addplot {x}; \addplot 
     {x^2};
     \nextgroupplot \addplot[green] {x}; \addplot {x^2};
     \end{groupplot}
     \begin{scope}[xshift=7.9cm,yshift=-3.8cm,scale=1]
        \begin{groupplot}[scale=0.5,
                            group style={group size=2 by 2},
                            cycle multiindex* list = {very 
                            thick\nextlist red\nextlist only 
                           marks\nextlist}
                           ]
           \nextgroupplot \addplot {x}; \addplot {x^2};
           \nextgroupplot \addplot {x}; \addplot {x^2};
           \nextgroupplot \addplot {x}; \addplot {x^2};
           \nextgroupplot \addplot {x}; \addplot {x^2};
       \end{groupplot}
       \end{scope}
   \end{tikzpicture}
\end{document}

enter image description here

EDIT

With a second look at your question I would advise the following process : - Create 1 document per image for a), b), and c) using an axis environment - Create 1 document for image d) using a groupplot - Assemble them in your final document using the figure and subfigure environments.

The Image.tex file should look like

\documentclass[10pt,a4paper,tikz]{standalone}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\pgfplotsset{style1/.style={cycle multiindex* list = {very thick\nextlist red\nextlist only marks\nextlist}}}
\begin{document}    
\begin{tikzpicture}
  \begin{axis}[style1]
        \addplot {x};
        \addplot {x^2};
        \end{axis}
        \end{tikzpicture}
  \begin{tikzpicture}
  \begin{axis}[style1,cycle list = {red, blue}]
  \addplot{x};
  \addplot{x^2};
  \end{axis}
  \end{tikzpicture}
  \begin{tikzpicture}
  \begin{axis}[style1]
\addplot[green] {x};
\addplot {x^2};
  \end{axis}
\end{tikzpicture}     
     \begin{tikzpicture}
        \begin{groupplot}[group style={group size=2 by 2},style1]
           \nextgroupplot \addplot {x}; \addplot {x^2};
           \nextgroupplot \addplot {x}; \addplot {x^2};
           \nextgroupplot \addplot {x}; \addplot {x^2};
           \nextgroupplot \addplot {x}; \addplot {x^2};
       \end{groupplot}
   \end{tikzpicture}
\end{document}

and in your main document, you should use something like

\begin{figure}
\begin{subfigure}{0.5\textwidth}
\includegraphics[page=1]{Image.pdf}
\end{figure}%
\begin{subfigure}{0.5\textwidth}
\includegraphics[page=2]{Image.pdf}
\end{figure}
\begin{subfigure}{0.5\textwidth}
\includegraphics[page=3]{Image.pdf}
\end{figure}%
\begin{subfigure}{0.5\textwidth}
\includegraphics[page=4,scale=0.5]{Image.pdf}
\end{figure}
2

Here is a version of Bamboo's first code, where instead of explicit xshift and yshift, I use the group name feature, make an invisible axis in the "big" groupplot and place the first small groupplot on the top left corner of that invisible axis. Instead of using scale I set appropriate widths for small groupplots.

To get the subcaptions you could load the subcaption package and use \subcaption{} in the title. Some modifications of the title style is needed for that.

\documentclass[10pt]{article}
\usepackage{subcaption}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\begin{document}    
\begin{figure}
  \begin{tikzpicture}
     \begin{groupplot}[
        group style={
           group size=2 by 2,
           group name=g, % add a name to each axis
           vertical sep=1cm,
           horizontal sep=1cm
        },
        width=0.4\textwidth,
        scale only axis,
        cycle multiindex* list = {
            very thick\nextlist
            red\nextlist 
            only marks\nextlist
          },
        title style={
          text width=6cm,
          below=12pt,
          at={(0.5,0)}
        }
     ] 
     \nextgroupplot[title={\subcaption{}}]
         \addplot {x}; \addplot {x^2};
     \nextgroupplot[
          title={\subcaption{}},
          cycle list = {red, blue}]
         \addplot {x}; \addplot {x^2};
     \nextgroupplot[title={\subcaption{}}] \addplot[green] {x}; \addplot {x^2};
     \nextgroupplot[hide axis,title={\subcaption{}}] % make an empty axis
     \end{groupplot}
     \begin{groupplot}[
        group style={
           group size=2 by 2,
           horizontal sep=1cm,
           vertical sep=1cm,
        },
        width={0.5*(0.4\textwidth-1cm)}, % (width of big subplot minus horizontal sep of this group)  divided by 2
        scale only axis,
        cycle multiindex* list = {
            very thick\nextlist
            red\nextlist 
            only marks\nextlist
          }
                           ]
           \nextgroupplot[at={(g c2r2.north west)},anchor=north west]
               \addplot {x}; \addplot {x^2};
           \nextgroupplot \addplot {x}; \addplot {x^2};
           \nextgroupplot \addplot {x}; \addplot {x^2};
           \nextgroupplot \addplot {x}; \addplot {x^2};
       \end{groupplot}
   \end{tikzpicture}
\caption{Main caption}
\end{figure}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.