I'm trying to place two TiKz pictures side by side in a two-column document (IEEEtrans style). I've looked at various solutions, but each one that claims to place figures side by side only manages to place the plots one above the other:
Currently I'm trying to use the subfigure
environment:
\documentclass[letterpaper, 10 pt, conference]{ieeeconf}
\IEEEoverridecommandlockouts
\overrideIEEEmargins
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{algorithm}
\usepackage{algorithmic}
\newcommand{\tsc}[1]{\textsuperscript{#1}}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{subcaption}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepgfplotslibrary{groupplots}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
decorations.pathreplacing,decorations.pathmorphing,shapes,%
matrix,shapes.symbols}
\pgfplotsset{
tick label style={font=\tiny}, %axis numbers font size
label style={font=\small}, %axis labels font size
legend style={font=\tiny}
}
\begin{figure}
\centering
\begin{subfigure}[t]{0.48\textwidth}
\centering
%\input{figs/roc_curve.tikz}
\resizebox{0.5\linewidth}{!}{\input{figs/roc.tikz}}
\caption{Caption A}
\label{fig:A}
\end{subfigure}
\begin{subfigure}[b]{0.48\textwidth}
\centering
%\input{figs/roc_curve.tikz}
\resizebox{0.5\linewidth}{!}{\input{figs/roc.tikz}}
\caption{Caption B}
\label{fig:B}
\end{subfigure}
\caption{ROC curve of failure detection;}
\label{fig:roc_curve}
\end{figure}
(...)
\end{document}
What exactly is forcing the plots to become only vertically aligned?
Best Answer
You have to use
\linewidth
or\columnwidth
instead of\textwidth
inin both places.
\textwidth
is the width of entire text including both columns. For details on\linewidth
and\textwidth
please refer to this answer.I have used
[b]
for both thesubfigure
s to align them properly.