2

I have the following LaTeX code in memoir class. I am having problem with the spacing between two top plots. Also the sub figure captions (a), (b) and (c) are not centered. I am a beginner in LaTeX but I am writing my PhD thesis. So any quick help will be appreciated.

\documentclass{memoir}
\usepackage{pgfplots}
\usepackage{subcaption}
\pgfplotsset{compat=1.3} 
\usepackage[margin=1in]{geometry}
\captionsetup{compatibility=false}
\begin{document} 

\begin{figure}\small
\begin{minipage}[b]{.5\linewidth}
\centering
\begin{tikzpicture}
\begin{axis}[xmin=-1, xmax=14, ymin=-100, ymax=1200, width =8 cm, xtick align =inside, ytick align =inside, xtick distance =3, ytick distance =200, xlabel = Nanosilica content (wt\%), ylabel= {Fracture energy, $G_{IC}$ ${(J/m^2)}$},legend style= {font=\tiny, legend pos= north west, legend cell align={left}}]
\addplot[cyan, thick] coordinates
{(0,220) (3,276) (6,302) (9,322) (12,338)};\addlegendentry{model (3 wt\% CSR-epoxy matrix)};
\addplot[only marks = o*,
    cyan, error bars/.cd,
                y dir=both,
                y explicit] table [x=a, y=b, y error = c]{F_7.3a.txt};\addlegendentry{Experimental};
\end{axis}
\end{tikzpicture}
\subcaption{}\label{fig:3a}
\end{minipage}%
%
\begin{minipage}[b]{.5\linewidth}
\centering
\begin{tikzpicture}
 \begin{axis}[xmin=-1, xmax=14, ymin=-100, ymax=1200, width = 8cm, xtick align =inside, ytick align =inside, xtick distance =3, ytick distance =200, xlabel = Nanosilica content (wt\%), ylabel= {Fracture energy, $G_{IC}$ ${(J/m^2)}$},legend style= {font=\tiny, legend pos= north west, legend cell align={left}}]
\addplot[cyan, thick] coordinates
{(0,430) (3,548) (6,604) (9,646) (12,681)};\addlegendentry{model (6 wt\% CSR-epoxy matrix)};
\addplot[only marks = o*,
    cyan, error bars/.cd,
                y dir=both,
                y explicit] table [x=a, y=b, y error = c]{F_7.3b.txt};\addlegendentry{Experimental};
\end{axis}
\end{tikzpicture}
\subcaption{}\label{fig:10b}
\end{minipage} \par\medskip
\centering
\begin{minipage}[b]{.5\linewidth}

\begin{tikzpicture}
 \begin{axis}[xmin=-1, xmax=14, ymin=-100, ymax=1200, width = 8cm, xtick align =inside, ytick align =inside, xtick distance =3, ytick distance =200, xlabel = Nanosilica content (wt\%), ylabel= {Fracture energy, $G_{IC}$ ${(J/m^2)}$},legend style= {font=\tiny, legend pos= north west, legend cell align={left}}]
\addplot[cyan, thick] coordinates
{(0,430) (3,548) (6,604) (9,646) (12,681)};\addlegendentry{model (6 wt\% CSR-epoxy matrix)};
\addplot[only marks = o*,
    cyan, error bars/.cd,
                y dir=both,
                y explicit] table [x=a, y=b, y error = c]{F_7.3b.txt};\addlegendentry{Experimental};
\end{axis}
\end{tikzpicture}
\subcaption{}\label{fig:10b}
\end{minipage}
\caption{Hybrid modified epoxy}\label{fig:10}
\end{figure}
\end{document}
  • I want to increase the distance between (a) and (b), as the y axis title of figure (b) is very close to figure (a). Thank you – Tasnuva Oct 29 '17 at 0:19
2

Please see the following MWE (important code changes marked with <=========):

\documentclass{memoir}

\usepackage{pgfplots}
\usepackage{subcaption}
\pgfplotsset{compat=1.3} 
\usepackage[%
  margin=1in,
  showframe % <=========================================================
]{geometry}
\usepackage{blindtext} % <==============================================
\captionsetup{compatibility=false}


\begin{document} 

\blindtext
\begin{figure}\small
\begin{minipage}[b]{.45\linewidth} % <==================================
\centering
\begin{tikzpicture}
\begin{axis}[xmin=-1, xmax=14, ymin=-100, ymax=1200, width =8 cm, xtick align =inside, ytick align =inside, xtick distance =3, ytick distance =200, xlabel = Nanosilica content (wt\%), ylabel= {Fracture energy, $G_{IC}$ ${(J/m^2)}$},legend style= {font=\tiny, legend pos= north west, legend cell align={left}}]
\addplot[cyan, thick] coordinates
{(0,220) (3,276) (6,302) (9,322) (12,338)};\addlegendentry{model (3 wt\% CSR-epoxy matrix)};
\addplot[only marks = o*,
    cyan, error bars/.cd,
                y dir=both,
                y explicit] table [x=a, y=b, y error = c]{F_7.3a.txt};\addlegendentry{Experimental};
\end{axis}
\end{tikzpicture}
\subcaption{test a}\label{fig:3a}
\end{minipage}%
\hfil % <===============================================================
\begin{minipage}[b]{.45\linewidth} % <==================================
\centering
\begin{tikzpicture}
 \begin{axis}[xmin=-1, xmax=14, ymin=-100, ymax=1200, width = 8cm, xtick align =inside, ytick align =inside, xtick distance =3, ytick distance =200, xlabel = Nanosilica content (wt\%), ylabel= {Fracture energy, $G_{IC}$ ${(J/m^2)}$},legend style= {font=\tiny, legend pos= north west, legend cell align={left}}]
\addplot[cyan, thick] coordinates
{(0,430) (3,548) (6,604) (9,646) (12,681)};\addlegendentry{model (6 wt\% CSR-epoxy matrix)};
\addplot[only marks = o*,
    cyan, error bars/.cd,
                y dir=both,
                y explicit] table [x=a, y=b, y error = c]{F_7.3b.txt};\addlegendentry{Experimental};
\end{axis}
\end{tikzpicture}
\subcaption{test test test test test test test test test test test test test test b}\label{fig:10b}
\end{minipage} 
\par\bigskip % \medskip <===============================================
\centering
\begin{minipage}[b]{.45\linewidth} % <==================================
\begin{tikzpicture}
 \begin{axis}[xmin=-1, xmax=14, ymin=-100, ymax=1200, width = 8cm, xtick align =inside, ytick align =inside, xtick distance =3, ytick distance =200, xlabel = Nanosilica content (wt\%), ylabel= {Fracture energy, $G_{IC}$ ${(J/m^2)}$},legend style= {font=\tiny, legend pos= north west, legend cell align={left}}]
\addplot[cyan, thick] coordinates
{(0,430) (3,548) (6,604) (9,646) (12,681)};\addlegendentry{model (6 wt\% CSR-epoxy matrix)};
\addplot[only marks = o*,
    cyan, error bars/.cd,
                y dir=both,
                y explicit] table [x=a, y=b, y error = c]{F_7.3b.txt};\addlegendentry{Experimental};
\end{axis}
\end{tikzpicture}
\subcaption{test test test test test test test test test test test test c}\label{fig:10b}
\end{minipage}
\caption{Hybrid modified epoxy}\label{fig:10}
\end{figure}
\blindtext
\end{document}

To get a bigger space between subfire a and b you need to reduce the width for the two minipages like:

\begin{minipage}[b]{.45\linewidth}

Change .45 for your needs (Three times! a), b), and c)). Between both minipages use a \hfil to get a small space (1-0.45-0.45=0.1\linewidth) between them ...

To get a bigger space between a/b and subfiger c change \medskip tobigskip` like:

\par\bigskip % \medskip

The subfigures are all centered. To show that I added a subcaption to subfigure b and c. Compare the smaller subcaption of subfigure a with them.

The resulting page of the MWE is:

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.