i have a two column document. i want to put those two images side to side. The first in the first column, the second in the second column:
\begin{figure}[htbp!]
\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\linewidth]{Fig/valence.png}
\caption{Correlation between external and self-assessed valence scores.}
\label{fig:subim1}
\end{subfigure}
\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\linewidth]{Fig/Arousal.png}
\caption{Correlation between external and self-assessed arousal scores.}
\label{fig:subim2}
\end{subfigure}
\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\linewidth]{Fig/Dominance.png}
\caption{Correlation between external and self-assessed dominance scores.}
\label{fig:subim3}
\end{subfigure}
\caption{Correlation between external and self-assessed indexes.}
\label{fig:corr_indexes}
\end{figure}
\begin{figure}[!h]
\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\linewidth]{Fig/valence_barplot.png}
\caption{STD of valence scores across videos.}
\label{fig:subim1_bar}
\end{subfigure}
\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\linewidth]{Fig/arousal_barplot.png}
\caption{STD of arousal scores across videos.}
\label{fig:subim2_bar}
\end{subfigure}
\begin{subfigure}{0.4\textwidth}
\includegraphics[width=\linewidth]{Fig/prob_barplot.png}
\caption{Average probability scores across videos.}
\label{fig:subim3_bar}
\end{subfigure}
\caption{Representation of the results for the STD analysis for the valence, arousal and probability scores for each participant.}
\label{fig:barplots}
\end{figure}
Assistant
To position two figures side by side in a two-column LaTeX document—specifically, placing the first figure in the first column and the second figure in the second column—you need to ensure that:
Figures are placed where you want them in the source code: In a two-column layout, LaTeX fills the first column before moving to the second. Therefore, you need to place the code for the first figure in the text where it will be typeset in the first column and the code for the second figure where the second column begins.
Control figure placement with the [H] specifier: Use the float package and the [H] placement specifier to force figures to appear exactly where they are defined in the source code, preventing them from floating to other locations.
Adjust subfigure widths using \columnwidth: In a two-column document, \textwidth refers to the width of the entire text block (both columns), while \columnwidth refers to the width of one column. To ensure your figures fit within a column, specify widths relative to \columnwidth.
Place figures where they should appear in the text: Insert the code for your first figure at the point in the text where the first column is being filled, and the code for the second figure where the second column starts.
Here's your modified code:
latex
\usepackage{float} % Include this in the preamble
...
% First Figure in the first column
\begin{figure}[H]
\centering
\begin{subfigure}{0.9\columnwidth}
\includegraphics[width=\linewidth]{Fig/valence.png}
\caption{Correlation between external and self-assessed valence scores.}
\label{fig:subim1}
\end{subfigure}
\par\medskip
\begin{subfigure}{0.9\columnwidth}
\includegraphics[width=\linewidth]{Fig/Arousal.png}
\caption{Correlation between external and self-assessed arousal scores.}
\label{fig:subim2}
\end{subfigure}
\par\medskip
\begin{subfigure}{0.9\columnwidth}
\includegraphics[width=\linewidth]{Fig/Dominance.png}
\caption{Correlation between external and self-assessed dominance scores.}
\label{fig:subim3}
\end{subfigure}
\caption{Correlation between external and self-assessed indices.}
\label{fig:corr_indexes}
\end{figure}
% Second Figure in the second column
\begin{figure}[H]
\centering
\begin{subfigure}{0.9\columnwidth}
\includegraphics[width=\linewidth]{Fig/valence_barplot.png}
\caption{STD of valence scores across videos.}
\label{fig:subim1_bar}
\end{subfigure}
\par\medskip
\begin{subfigure}{0.9\columnwidth}
\includegraphics[width=\linewidth]{Fig/arousal_barplot.png}
\caption{STD of arousal scores across videos.}
\label{fig:subim2_bar}
\end{subfigure}
\par\medskip
\begin{subfigure}{0.9\columnwidth}
\includegraphics[width=\linewidth]{Fig/prob_barplot.png}
\caption{Average probability scores across videos.}
\label{fig:subim3_bar}
\end{subfigure}
\caption{Results of the STD analysis for the valence, arousal, and probability scores for each participant.}
\label{fig:barplots}
\end{figure}
Explanation:
\columnwidth: Using 0.9\columnwidth ensures that each subfigure fits within the column width, preventing overflow and layout issues.
\par\medskip: Adds space between subfigures vertically. Since you're stacking three subfigures in each figure, this keeps them neatly separated.
Placement of Figures: By placing the first figure environment where the first column content is being typeset and the second figure where the second column starts, you guide LaTeX to position them side by side across the two columns.
Additional Tips:
Balancing Columns: If your document class supports it, you might want to use the flushend package to balance the columns on the last page.
Adjusting Spacing: You can adjust the \medskip to \smallskip or \bigskip depending on how much space you want between subfigures.
Note: Be cautious with the [H] placement specifier. While it enforces strict placement, overusing it can lead to awkward breaks and spacing in your document. Use it judiciously to maintain the flow and appearance of your content.
By making these adjustments, your two figures should appear side by side in their respective columns, each containing their subfigures properly formatted and sized.