0

Consider this code

\documentclass{article}
\pagestyle{empty}
\usepackage{pgfplots,subfigure}
\usepackage[justification=centering]{caption}
\usepackage{floatrow}

\begin{document}
    \begin{figure}
        \floatbox[{\capbeside
            \captionsetup[capbesidefigure]{labelsep=newline,justification=RaggedRight,labelfont=bf}
            \thisfloatsetup{capbesideposition={right,center},capbesidewidth=4cm}}]{figure}
        [\FBwidth]
        {\caption{Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua}\label{fig:label}}
        \centering
        \subfigure{
            \begin{tikzpicture}[remember picture]
            \begin{axis}[
            axis lines=left,
            xmin=0,
            xmax=7.5,
            xtick={1,...,8},
            ymin=0,
            ymax=105,
            thick,
            grid=both,
            width=0.6\textwidth
            ]
            \addplot[smooth,thick] plot coordinates {
                (0,35)
                (1,60)
                (2,20)
                (3,95)
                (4,45)
                (5,30)
                (6,60)
                (7,55)
            };
            \end{axis}
            \end{tikzpicture}
        }

        \subfigure{
            \begin{tikzpicture}[remember picture]
            \begin{axis}[
            axis lines=left,
            xmin=0,
            xmax=7.5,
            xtick={1,...,8},
            ymin=0,
            ymax=105,
            thick,
            grid=both,
            width=0.6\textwidth
            ]
            \addplot[smooth,thick] plot coordinates {
                (0,45)
                (1,55)
                (2,40)
                (3,70)
                (4,55)
                (5,35)
                (6,50)
                (7,45)
            };
            \end{axis}
            \end{tikzpicture}
        }

        \subfigure{
            \begin{tikzpicture}[remember picture]
            \begin{axis}[
            axis lines=left,
            xmin=0,
            xmax=7.5,
            xtick={1,...,8},
            ymin=0,
            ymax=105,
            thick,
            grid=both,
            width=0.6\textwidth
            ]
            \addplot[smooth,thick] plot coordinates {
                (0,45)
                (1,55)
                (2,40)
                (3,60)
                (4,55)
                (5,35)
                (6,50)
                (7,45)
            };
            \end{axis}
            \end{tikzpicture}
        }
    \end{figure}
\end{document}

What I get from above code is

image.

How can I modify the code so that the caption would be at the (right) side of the figure? Note: the code works perfectly in single figure.

2
\documentclass{article}
\pagestyle{empty}
\usepackage{pgfplots}

\usepackage[justification=centering]{caption}
\usepackage{floatrow}
\usepackage{graphicx}
\usepackage[font=footnotesize,figurewithin=none]{caption}
\usepackage{subcaption}
\captionsetup{justification=raggedright,subrefformat=parens} % will result in references (typeset with \ref) like  1a  but sub-references (typeset with\subref) like  (a)
\usepackage{floatrow}
\floatsetup[subfigure]{style=plain,subcapbesideposition=top}
%\usepackage{subfig} % not compatible with subcaption

\begin{document}

\begin{figure}
  \centering
  \begin{subfigure}[t]{0.7\textwidth}
    \begin{tikzpicture}[remember picture]
            \begin{axis}[
            axis lines=left,
            xmin=0,
            xmax=7.5,
            xtick={1,...,8},
            ymin=0,
            ymax=105,
            thick,
            grid=both,
            width=0.6\textwidth
            ]
            \addplot[smooth,thick] plot coordinates {
                (0,35)
                (1,60)
                (2,20)
                (3,95)
                (4,45)
                (5,30)
                (6,60)
                (7,55)
            };
            \end{axis}
            \end{tikzpicture}



    \begin{tikzpicture}[remember picture]
            \begin{axis}[
            axis lines=left,
            xmin=0,
            xmax=7.5,
            xtick={1,...,8},
            ymin=0,
            ymax=105,
            thick,
            grid=both,
            width=0.6\textwidth
            ]
            \addplot[smooth,thick] plot coordinates {
                (0,45)
                (1,55)
                (2,40)
                (3,70)
                (4,55)
                (5,35)
                (6,50)
                (7,45)
            };
            \end{axis}
            \end{tikzpicture}
  \\
  \hfill

    \begin{tikzpicture}[remember picture]
            \begin{axis}[
            axis lines=left,
            xmin=0,
            xmax=7.5,
            xtick={1,...,8},
            ymin=0,
            ymax=105,
            thick,
            grid=both,
            width=0.6\textwidth
            ]
            \addplot[smooth,thick] plot coordinates {
                (0,45)
                (1,55)
                (2,40)
                (3,60)
                (4,55)
                (5,35)
                (6,50)
                (7,45)
            };
            \end{axis}
            \end{tikzpicture}
  \end{subfigure}
  \begin{subfigure}[t]{0.25\textwidth}
  {\caption*{ \textbf{Figure 1} \\ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua }\label{subfig:label}}

  \end{subfigure}
\end{figure}
\end{document}

I suggest merging the three subfigures in one and create a second subfigure which is empty of content and provides the space for the caption. I am sure there must be another more proper way to solve your problem, but this one does the job too. The only problem is that the label is not functional this way.

Output Output

  • This is nice but the gap between figures and caption is too wide – Sukan Dec 30 '17 at 4:15

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.