Can't place figures side by side
You have to use \linewidth
or \columnwidth
instead of \textwidth
in
\begin{subfigure}[b]{0.48\textwidth}
in both places. \textwidth
is the width of entire text including both columns. For details on \linewidth
and \textwidth
please refer to this answer.
\documentclass[letterpaper,10 pt,conference]{ieeeconf}
\usepackage{graphicx,subcaption}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[b]{0.48\linewidth} %% or \columnwidth
\centering
\includegraphics[width=\linewidth]{example-image-a}
\caption{Caption A}
\label{fig:A}
\end{subfigure}
\begin{subfigure}[b]{0.48\linewidth} %% or \columnwidth
\centering
\includegraphics[width=\linewidth]{example-image-b}
\caption{Caption B}
\label{fig:B}
\end{subfigure}
\caption{ROC curve of failure detection;}
\label{fig:roc_curve}
\end{figure}
(...)
\end{document}
I have used [b]
for both the subfigure
s to align them properly.
If you want to place two figures side by side over one column, Harish's solution is what you need. But if you want to place both figures over both columns, you have to use a figure*
environment. When you use a twocolumn
document, figure
and table
environments are as wide as a column, while figure*
and table*
use both columns.
Next example shows this differences. First one is taken from Harish's answer and the second one uses figure*
.
\documentclass[letterpaper,10 pt,conference]{ieeeconf}
\usepackage{graphicx,subcaption}
\usepackage{lipsum}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[b]{0.48\linewidth} %% or \columnwidth
\centering
\includegraphics[width=\linewidth]{example-image-a}
\caption{Caption A}
\label{fig:A}
\end{subfigure}
\begin{subfigure}[b]{0.48\linewidth} %% or \columnwidth
\centering
\includegraphics[width=\linewidth]{example-image-b}
\caption{Caption B}
\label{fig:B}
\end{subfigure}
\caption{ROC curve of failure detection;}
\label{fig:roc_curve}
\end{figure}
\lipsum
\begin{figure*}
\centering
\begin{subfigure}[b]{\columnwidth} %% or \columnwidth
\centering
\includegraphics[width=\linewidth]{example-image-a}
\caption{Caption A}
\label{fig:A}
\end{subfigure}
\hfill
\begin{subfigure}[b]{\columnwidth} %% or \columnwidth
\centering
\includegraphics[width=\linewidth]{example-image-b}
\caption{Caption B}
\label{fig:B}
\end{subfigure}
\caption{ROC curve of failure detection;}
\label{fig:roc_curve}
\end{figure*}
\lipsum
\end{document}