如何在左、右、上有多個影像?

如何在左、右、上有多個影像?

基本上我想要一個如下圖的圖:

在此輸入影像描述

但是,我可以從左到右,如何添加向上?

\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{pgfplots}
\usepackage{subcaption}

\begin{document}


\begin{figure}[ht]
\begin{subfigure}{.5\textwidth}
  \centering
  % include first image
  \includegraphics[width=.5\linewidth]{image_file_name}  
  \caption{Put your sub-caption here}
  \label{fig:sub-first}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
  \centering
  % include second image
  \includegraphics[width=.5\linewidth]{image_file_name}  
  \caption{Put your sub-caption here}
  \label{fig:sub-second}
\end{subfigure}
\caption{Put your caption here}
\label{fig:fig}
\end{figure}

\end{document}

我當前的輸出:

在此輸入影像描述

答案1

只需添加第三張圖片...或者我錯過了什麼?

\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{pgfplots}
\usepackage{subcaption}

\begin{document}


    \begin{figure}[ht]
        \begin{subfigure}{\textwidth}
            \centering
            % include first image
            \includegraphics[width=.25\linewidth]{example-image-a}  
            \caption{Put your sub-captionA here}
            \label{fig:sub-firstA}
        \end{subfigure}
        \begin{subfigure}{.5\textwidth}
            \centering
            % include first image
            \includegraphics[width=.5\linewidth]{example-image-b}  
            \caption{Put your sub-captionB here}
            \label{fig:sub-first}
        \end{subfigure}
        \begin{subfigure}{.5\textwidth}
            \centering
            % include second image
            \includegraphics[width=.5\linewidth]{example-image-c}  
            \caption{Put your sub-captionC here}
            \label{fig:sub-second}
        \end{subfigure}
        \caption{Put your caption here}
        \label{fig:fig}
    \end{figure}

\end{document}
\end{document}

在此輸入影像描述

更新 影像之間的空間較小

\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{pgfplots}
\usepackage{subcaption}

\begin{document}


    \begin{figure}[ht]
        \begin{subfigure}{\textwidth}
            \centering
            % include first image
            \includegraphics[width=.45\linewidth]{example-image-a}   % this width should be half of the width of the other two images
            \caption{Put your sub-captionA here}
            \label{fig:sub-firstA}
        \end{subfigure}
        \begin{subfigure}{.5\textwidth} % this sets the figure to be max half the width of the page
            \centering
            % include first image
            \includegraphics[width=.9\linewidth]{example-image-b}  % this sets the image to fill 90% of the available space -> 45% of the line width in total. 
            \caption{Put your sub-captionB here}
            \label{fig:sub-first}
        \end{subfigure}
        \begin{subfigure}{.5\textwidth}
            \centering
            % include second image
            \includegraphics[width=.9\linewidth]{example-image-c}  
            \caption{Put your sub-captionC here}
            \label{fig:sub-second}
        \end{subfigure}
        \caption{Put your caption here}
        \label{fig:fig}
    \end{figure}

\end{document}

在此輸入影像描述

答案2

在此範例中,我將子圖/標題的寬度減小到圖像的寬度。請注意,放置\hfil在兩個較低的子圖之間會擴展為與 相同的間隙\centering,而\hfill將子圖一直推到邊緣。

\documentclass{article}
\usepackage[margin=0.5in,showframe]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage{pgfplots}
\usepackage{subcaption}

\begin{document}

\begin{figure}[ht]
\centering
\begin{subfigure}{.45\textwidth}
  \includegraphics[width=\linewidth]{example-image-a}  
  \caption{Put your sub-caption here}
  \label{fig:sub-first}
\end{subfigure}% ending a line with a brace adds a space
\vspace{\floatsep}% space added between consecutive floats

\begin{subfigure}{.45\textwidth}
  \includegraphics[width=\linewidth]{example-image-b}  
  \caption{Put your sub-caption here}
  \label{fig:sub-secon}
\end{subfigure}\hfil
\begin{subfigure}{.45\textwidth}
  \includegraphics[width=\linewidth]{example-image-c}  
  \caption{Put your sub-caption here}
  \label{fig:sub-third}
\end{subfigure}
\caption{Put your caption here}
\label{fig:fig}
\end{figure}

\end{document}

示範

相關內容