1

I have multiple figures on my page, from previous posts here I have tried to arrange them 2 figures at a time. I wish to make all 4 figures appear as 1 with sub-labels as (a) , (b) , (c) , (d) which are all properly aligned among each other.

Code: This code has 2 figures with 2 figures within them.

\begin{figure}[t]
\centering
\begin{minipage}{.45\linewidth}
  \pgfplotsset{every axis/.append style={scale=0.8}}
  \input{figs/FIG_5.tikz}
  \captionof{figure}{First caption}
  \label{fig:LV}
\end{minipage}\hfill
\begin{minipage}{.45\linewidth}
  \pgfplotsset{every axis/.append style={scale=0.8}}
  \input{figs/Fig12.tikz}
  \captionof{figure}{Second caption}
  \label{fig:LV2}
\end{minipage}
\end{figure}

\begin{figure}[t] \centering \begin{minipage}{0.45\textwidth} \centering \pgfplotsset{every axis/.append style={scale=0.8}} %\graphicspath{figs/FIG_3.tikz} \input{figs/FIG_3.tikz} % first figure itself \caption{first figure} \label{fig:EW} \end{minipage}\hfill \begin{minipage}{0.45\textwidth} \centering \pgfplotsset{every axis/.append style={scale=0.8}} \input{figs/Fig11.tikz} % second figure itself \caption{second figure} \label{fig:EW2} \end{minipage} \end{figure}

Code Fig 5 and Fig 3:

\documentclass{article}
\usepackage{pgfplots}

\begin{document} \begin{tikzpicture}

\pgfplotsset{ set layers,% using layers mark layer=axis tick labels,% defines the layer of the marks every axis/.append style={scale=1.2} }

\begin{semilogyaxis}[ xmin=0, xmax=205, ymin=1e-1, ymax=1e5, xlabel={Oscilatoriness parameter ($k$)}, ylabel={Gain in performance ($\alpha$)}, label style={font=\bfseries\boldmath}, tick label style={font=\bfseries\boldmath}, legend pos=outer north east, scatter/classes={ a={mark=square, violet}, a1={mark=square, red}, ] \addplot[scatter, only marks, scatter src=explicit symbolic] table[meta=label] { x y label

5 5.67E+00 a 5 6.67E-01 a1

}; \end{semilogyaxis}

\end{tikzpicture} \end{document}

Code : figure 11:

\begin{tikzpicture}
\begin{axis}[axis x line=middle,axis y line=left,xlabel=$x$,restrict y to domain =-9:9, legend pos=north west ]
\addplot[orange,samples=500,domain=0:1.5]plot (\x, {exp(\x)*sin(100*cosh(\x) r)});
\addplot[orange,samples=1000,domain=1.5:2]plot (\x, {exp(\x)*sin(100*cosh(\x) r)});
%\legend{\textcolor{orange}{$\mathrm e^x\sin\left(100\cosh\left(x\right)\right)$}}

\addplot[blue,samples=500,domain=0:1.5]plot (\x, {exp(\x)sin(10cosh(\x) r)}); \addplot[blue,samples=1000,domain=1.5:2]plot (\x, {exp(\x)sin(10cosh(\x) r)});

\legend{\textcolor{orange}{$\mathrm e^x\sin\left(100\cosh\left(x\right)\right)$}, \textcolor{blue}{$\mathrm e^x\sin\left(10\cosh\left(x\right)\right)$}}

\end{axis} \end{tikzpicture}

figure 12:

\begin{pspicture}(0,-.5)(20,1.0)
\rput(13,0.8){%
    $\displaystyle J_n(x)=\frac{1}{\pi}\int_0^\pi\cos(x\sin t-nt)\mathrm{d}t$}
\psaxes[Dy=0.2,Dx=4]{->}(0,0)(0,-.4)(25,1)
\psset{linewidth=1pt}
\psBessel[linecolor=red]{0}{-0}{25}%
\psBessel[linecolor=blue]{1}{-0}{25}%
\psBessel[linecolor=green]{2}{-0}{25}%
\psBessel[linecolor=magenta]{3}{-0}{25}%
\end{pspicture}

enter image description here

1 Answers1

1

Instead of copying all your figures I just replaced them here with some example images. Nevertheless this should suit your needs.

\documentclass{article}
\usepackage{subcaption,graphicx,pgfplots}

\begin{document} \begin{figure}[t] \centering \subcaptionbox{First caption.\label{fig:LV}}[.45\linewidth]{% \pgfplotsset{every axis/.append style={scale=0.8}}% %\input{figs/FIG_5.tikz}% \includegraphics[width=0.5\linewidth,height=5cm]{example-image-a}% }\hfill \subcaptionbox{Second caption which goes over multiple lines is also aligned properly.\label{fig:LV2}}[.45\linewidth]{ \pgfplotsset{every axis/.append style={scale=0.8}}% %\input{figs/Fig12.tikz}% \includegraphics[width=\linewidth]{example-image-b}% } \subcaptionbox{Third caption.\label{fig:EW}}[.45\linewidth]{ \pgfplotsset{every axis/.append style={scale=0.8}}% %\graphicspath{figs/FIG_3.tikz}% %\input{figs/FIG_3.tikz} % first figure itself \includegraphics[width=\linewidth]{example-image-c}% }\hfill \subcaptionbox{Fourth caption. In every good example there should be a duck!\label{fig:EW2}}[.45\linewidth]{% \pgfplotsset{every axis/.append style={scale=0.8}}% %\input{figs/Fig11.tikz} % second figure itself \includegraphics[width=\linewidth]{example-image-duck}% } \caption{Collection of all my cool figures.} \end{figure} References: \ref{fig:LV}, \ref{fig:LV2}, \ref{fig:EW}, \ref{fig:EW2}. \end{document}

Result

Οὖτις
  • 2,897
  • 1
  • 5
  • 18
  • That's indeed very helpful! – Formal_this Mar 23 '23 at 18:57
  • Hey, hoe to make all the respective boxes (figs) of the same dimension? As you can see in my figure above, the bottom figure (FIG 9) is unnecessarily larger than (FIG 8). I am using \input{figs/FIG_7.tikz} instead of your includegraphics line. – Formal_this Aug 01 '23 at 02:58
  • Sorry, I am unfamiliar with pspicture. At least for consistency I'd recommend to use tikz/pgf also for this figure instead of switching to pspicture. This does not seem to be too hard: https://tex.stackexchange.com/q/160748/237192. As long as you don't play around with the height and width keys, all resulting pictures should have (at least roughly, maybe ignoring ticklabels etc.) the same size. – Οὖτις Aug 02 '23 at 05:14
  • Hey, thanks for the help. Also, can you help me with a follow up question. https://tex.stackexchange.com/questions/692550/correction-required-in-subfigures-and-labels-of-figures-in-tikz – Formal_this Aug 02 '23 at 05:32