This refers to the following link
I have applied this methodology for my group plots,it works well and is way less complex than the other solutions. The only issue I am having is that my y-axis label is a bit offset from the axis. (Extra gap highlighted by the ellipse).Not sure how to fix it.
MWE:
\documentclass{standalone}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{pgfplots.groupplots}
\pgfplotsset{plot coordinates/math parser=false}
\usetikzlibrary{pgfplots.units}
\begin{document}
\sbox0{\includegraphics[width=4in]{example-image-a}}%
\sbox1{\includegraphics[width=4in]{example-image-a}}%
\begin{tikzpicture}
\begin{groupplot}[
group style={
group name=my plots,
group size=1 by 2,
xlabels at=edge bottom,
xticklabels at=edge bottom,
vertical sep=0pt
},
scale only axis, width={\wd0}, height={\ht0},
ybar,
footnotesize,
width=5.4in,
height=1in,
xlabel={Length($mm$)},
% ylabel={Height($mm$)},
xmin=0, xmax=10,
ymin=0, ymax=0.6,
xtick={0,1,...,10},
xticklabels={0,1,...,10},
ytick={0,0.2,...,0.6},
yticklabels={0,0.2,0.4,0.6},
tickpos=left,
ytick align=outside,
xtick align=outside
]
\nextgroupplot
\addplot graphics[xmin=0,ymin=0,xmax=10,ymax=0.6] {example-image-a};
\nextgroupplot[ylabel=Height($mm$),
every axis y label/.append style={at=(ticklabel cs:1.0)}]
\addplot graphics[xmin=0,ymin=0,xmax=10,ymax=0.6] {example-image-b};
\end{groupplot}
\end{tikzpicture}
\end{document}

