TransWikia.com

Multiple Panel Figures with Captions Grouped Together

TeX - LaTeX Asked by Ross Aylen on April 25, 2021

I have managed to make this:

enter image description here

but I’m trying to make this:

enter image description here

the difference being that the captions are grouped together in a minature format of the figure.

the code:

usepackage{caption}
usepackage{subcaption}
usepackage{graphicx}
graphicspath{ {./figures/} }
usepackage{float}

begin{figure}[H]
    begin{subfigure}[t]{0.33textwidth}
        centering
        includegraphics[width=linewidth]{figures/Image1BW.png} 
        caption{}label{fig:Image1BW}
    end{subfigure}
    hfill
    begin{subfigure}[t]{0.33textwidth}
        centering
        includegraphics[width=linewidth]{figures/Image1BWPhaseMaskOnly.png} 
        caption{}label{fig:Image1BWPhaseMaskOnly}
    end{subfigure}
    hfill
    begin{subfigure}[t]{0.33textwidth}
        centering
        includegraphics[width=linewidth]{figures/Image1BWSpatialAndPhaseMask.png} 
        caption{}label{fig:Image1BWSpatialAndPhaseMask}
    end{subfigure}

    begin{subfigure}[t]{0.33textwidth}
        centering
        includegraphics[width=linewidth]{figures/Image3Colour.png} 
        caption{}label{fig:Image3Colour}
    end{subfigure}
    hfill
    begin{subfigure}[t]{0.33textwidth}
        centering
        includegraphics[width=linewidth]{figures/Image3ColourPhaseMaskOnly.png} 
        caption{}label{fig:Image3ColourPhaseMaskOnly}
    end{subfigure}
    hfill
    begin{subfigure}[t]{0.33textwidth}
        centering
        includegraphics[width=linewidth]{figures/Image3ColourPhaseAndSpatialMask.png} 
        caption{}label{fig:Image3ColourPhaseAndSpatialMask}
    end{subfigure}
    caption{Development of code to encrypt image. (subref{fig:Image1BW}) Image to be encrypted. (subref{fig:Image1BWPhaseMaskOnly}) Encryption through convolution with phase mask. (subref{fig:Image1BWSpatialAndPhaseMask}) Encryption through  multiplication and convolution with phase mask. (subref{fig:Image3Colour})(subref{fig:Image3ColourPhaseMaskOnly})(subref{fig:Image3ColourPhaseAndSpatialMask}) Results of colour images through the same process.}
end{figure}

EDIT: SUSSED IT NO SWEAT

    begin{figure}[H]
        begin{subfigure}[t]{0.33textwidth}
            centering
            includegraphics[width=linewidth]{figures/Image1BW.png}
            caption{}label{fig:Image1BW}
        end{subfigure}
        hfill
        begin{subfigure}[t]{0.33textwidth}
            centering
            includegraphics[width=linewidth]{figures/Image1BWPhaseMaskOnly.png} 
            caption{}label{fig:Image1BWPhaseMaskOnly}
        end{subfigure}
        hfill
        begin{subfigure}[t]{0.33textwidth}
            centering
            includegraphics[width=linewidth]{figures/Image1BWSpatialAndPhaseMask.png} 
            caption{}label{fig:Image1BWSpatialAndPhaseMask}
        end{subfigure}
        
        begin{subfigure}[t]{0.33textwidth}
            centering
            includegraphics[width=linewidth]{figures/Image3Colour.png} 
            caption{}label{fig:Image3Colour}
        end{subfigure}
        hfill
        begin{subfigure}[t]{0.33textwidth}
            centering
            includegraphics[width=linewidth]{figures/Image3ColourPhaseMaskOnly.png} 
            caption{}label{fig:Image3ColourPhaseMaskOnly}
        end{subfigure}
        hfill
        begin{subfigure}[t]{0.33textwidth}
            centering
            includegraphics[width=linewidth]{figures/Image3ColourPhaseAndSpatialMask.png} 
            caption{}label{fig:Image3ColourPhaseAndSpatialMask}
        end{subfigure}
        vfill
        begin{matrix}
            subref{fig:Image1BW} & subref{fig:Image1BWPhaseMaskOnly} & subref{fig:Image1BWSpatialAndPhaseMask}
            subref{fig:Image3Colour} & subref{fig:Image3ColourPhaseMaskOnly} & subref{fig:Image3ColourPhaseAndSpatialMask}
        end{matrix}
        hfill  
        caption{Development of code to encrypt image. (subref{fig:Image1BW}) Image to be encrypted. (subref{fig:Image1BWPhaseMaskOnly}) Encryption through convolution with phase mask. (subref{fig:Image1BWSpatialAndPhaseMask}) Encryption through  multiplication and convolution with phase mask. (subref{fig:Image3Colour})(subref{fig:Image3ColourPhaseMaskOnly})(subref{fig:Image3ColourPhaseAndSpatialMask}) Results of colour images through the same process.}label{fig:Imaginary Encrypt}
    end{figure}

enter image description here

Still isn’t perfectly the same but getting there

2 Answers

Here's a janky solution, was much easier to make this on docs but here in latex land you don't have to manually reference things. Case in point, I can now automagically reference this figure and its subfigures FANTASTIC!

Here's the output:

beauty

Here's the code:

usepackage{caption}
usepackage{subcaption}
usepackage{graphicx}
graphicspath{ {./figures/} }
usepackage{float}
usepackage{titlesec}
usepackage{enumitem}
usepackage{amsmath}
usepackage{xcolor}

captionsetup[subfigure]{labelfont= {color = white}, font = tiny}
captionsetup[figure]{labelfont = bf}

begin{document}
    begin{figure}[H]
        begin{subfigure}[t]{0.32textwidth}
            centering
            includegraphics[width=linewidth]{figures/Image1BW.png}
            caption{}label{fig:Image1BW}
        end{subfigure}
        hfill
        begin{subfigure}[t]{0.32textwidth}
            centering
            includegraphics[width=linewidth]{figures/Image1BWPhaseMaskOnly.png} 
            caption{}label{fig:Image1BWPhaseMaskOnly}
        end{subfigure}
        hfill
        begin{subfigure}[t]{0.32textwidth}
            centering
            includegraphics[width=linewidth]{figures/Image1BWSpatialAndPhaseMask.png} 
            caption{}label{fig:Image1BWSpatialAndPhaseMask}
        end{subfigure}
        
        begin{subfigure}[t]{0.32textwidth}
            centering
            includegraphics[width=linewidth]{figures/Image3Colour.png} 
            caption{}label{fig:Image3Colour}
        end{subfigure}
        hfill
        begin{subfigure}[t]{0.32textwidth}
            centering
            includegraphics[width=linewidth]{figures/Image3ColourPhaseMaskOnly.png} 
            caption{}label{fig:Image3ColourPhaseMaskOnly}
        end{subfigure}
        hfill
        begin{subfigure}[t]{0.32textwidth}
            centering
            includegraphics[width=linewidth]{figures/Image3ColourPhaseAndSpatialMask.png} 
            caption{}label{fig:Image3ColourPhaseAndSpatialMask}
        end{subfigure}
        vfill
        $begin{minipage}{0.1textwidth}
            $begin{matrix}
                textbf{subref{fig:Image1BW}} & textbf{subref{fig:Image1BWPhaseMaskOnly}} & textbf{subref{fig:Image1BWSpatialAndPhaseMask}}
                textbf{subref{fig:Image3Colour}} & textbf{subref{fig:Image3ColourPhaseMaskOnly}} & textbf{subref{fig:Image3ColourPhaseAndSpatialMask}}
            end{matrix}$
        end{minipage}$
        begin{minipage}{0.9textwidth}
            caption{Development of code to encrypt image. (subref{fig:Image1BW}) Image to be encrypted. (subref{fig:Image1BWPhaseMaskOnly}) Encryption through convolution with phase mask. (subref{fig:Image1BWSpatialAndPhaseMask}) Encryption through  multiplication and convolution with phase mask. (subref{fig:Image3Colour}) (subref{fig:Image3ColourPhaseMaskOnly}) (subref{fig:Image3ColourPhaseAndSpatialMask}) Results of colour images through the same process.label{fig:Imaginary Encrypt}}
        end{minipage}
    end{figure}
end{document}

Answered by Ross Aylen on April 25, 2021

It is not entirely clear what exactly is your problem. A simple code, which reproduce showed desired result is:

documentclass{book}    % used document class is unknown
usepackage{geometry}   % page layout is unknown

usepackage{graphicx} 
graphicspath{ {./figures/} }

usepackage{caption}
captionsetup[figure]{font=small, labelfont = bf}
usepackage{booktabs, tabularx}

begin{document}
    begin{figure}[ht]
    setkeys{Gin}{width=linewidth}
begin{tabularx}{textwidth}{@{} XXX @{}}
includegraphics{example-image-a}   &   % {figures/Image1BW.png}
includegraphics{example-image-b}   &   % {figures/Image1BWPhaseMaskOnly.png}
includegraphics{example-image-c}     % {figures/Image1BWSpatialAndPhaseMask.png}
    addlinespace 
includegraphics{example-image}     &   % {figures/Image3Colour.png}
includegraphics{example-image}     &   % {figures/Image3ColourPhaseMaskOnly.png}
includegraphics{example-image}         % {figures/Image3ColourPhaseAndSpatialMask.png}
    end{tabularx}

begin{minipage}{0.1textwidth}small
    setlengtharraycolsep{3pt}
    $begin{array}{ccc}
mathbf{a}  & mathbf{b}    &   mathbf{c}  
mathbf{d}  & mathbf{e}    &   mathbf{f}  
            end{array}$
end{minipage}%
begin{minipage}{0.9textwidth}
    caption{Development of code to encrypt image. 
(textbf{a}) Image to be encrypted. 
(textbf{b}) Encryption through convolution with phase mask. 
(textbf{c}) Encryption through  multiplication and convolution with phase mask. 
(textbf{a}) (textbf{a}) (textbf{a}) Results of colour images through the same process.}
    label{fig:Imaginary Encrypt}
end{minipage}
    end{figure}
end{document}

enter image description here

Answered by Zarko on April 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP