I would like to know how I can go about automatically centering the plots subcaptions in the standalone environment. This is what I would like:
Here is my code:
\documentclass[varwidth]{standalone}
\usepackage{pgfplots,pgfplotstable, booktabs}
\usepackage{graphicx}
\usepackage{float}
\usepackage{subfig}
\usepackage{xcolor}
\definecolor{ocre}{RGB}{0,173,239} % mybluei Blue color
\usetikzlibrary{pgfplots.groupplots, matrix, backgrounds}
\pgfplotsset{%
compat=1.12,
every tick label/.append style={font=\scriptsize},
every axis plot/.append style={line width=0.8pt},
minor grid style={dashed,red},
major grid style={dotted,green!50!black},
}
\captionsetup[subfigure]{labelfont={color=ocre,scriptsize,it,bf},textfont={color=ocre,scriptsize,it,bf},labelformat=parens,labelsep=space}
\begin{document}
\begin{figure}[H]
\begin{center}
\begin{tikzpicture}
\setcaptionsubtype
\begin{groupplot}[%
,group style={%
,group name=my plots
,group size=1 by 2
,vertical sep=2cm,
,horizontal sep = 2cm,
,ylabels at=edge left
}
,width=10cm
,height=5cm
,try min ticks=5
,xlabel={\bfseries{\emph{\footnotesize{Time (ms)}}}}
,ylabel={\bfseries{\emph{\footnotesize{Temperature (Deg C)}}}}
,grid=both
,every major grid/.style={gray, opacity=0.5}
]
\nextgroupplot%
\addplot[cyan]{rand};\label{plots:ltone}
\nextgroupplot%
\addplot[cyan]{rand};\label{plots:lttwo}
\addplot [smooth,red,thick]{rand};
\end{groupplot}
\node[text width=.5\linewidth,align=center,anchor=south] at (my plots c1r1.north) {\caption[]{Lock Time Response\label{subplot:ltone}}};
\node[text width=.5\linewidth,align=center,anchor=south] at (my plots c1r2.north) {\caption[]{Zoomed-In Lock Time Response\label{subplot:lttwo}}};
\end{tikzpicture}
%\caption[]{This is a test Plot.}
\end{center}
\end{figure}
\end{document}
node
for the caption is centered, but the caption itself is a bit left aligned. Addingjustification=centering
to your\captionsetup
fixes that, but I don't know if that will mess up any of your other subfigure captions.\captionsetup{justification=centering}
right after\setcaptionsubtype
.