In this MWE, how can I make tikzpicture fit the allocated space of parent float environment (figure or subfigure)?
\RequirePackage{luatex85}
\documentclass{article}
\usepackage{pgfplots,caption,subcaption,mwe}
\pgfplotsset{compat=newest}
\begin{document}
\begin{figure}
\begin{subfigure}[t]{0.3\textwidth}
\begin{tikzpicture}
\begin{axis}[enlargelimits=false]
\addplot graphics [
xmin=0,
xmax=50,
ymin=0,
ymax=150,
] {example-image-a};
\end{axis}
\end{tikzpicture}
\end{subfigure}
%
\begin{subfigure}[t]{0.3\textwidth}
\begin{tikzpicture}
\begin{axis}[enlargelimits=false]
\addplot graphics [
xmin=0,
xmax=50,
ymin=0,
ymax=150,
] {example-image-b};
\end{axis}
\end{tikzpicture}
\end{subfigure}
%
\begin{subfigure}[t]{0.3\textwidth}
\begin{tikzpicture}
\begin{axis}[enlargelimits=false]
\addplot graphics [
xmin=0,
xmax=50,
ymin=0,
ymax=150,
] {example-image-c};
\end{axis}
\end{tikzpicture}
\end{subfigure}
\end{figure}
\end{document}
Edit
The output of code below doesn't make subfigures span over all \textwidth despite making each subfigure width equal to 0.33\textwidth.
\begin{figure}
\centering
\begin{subfigure}[t]{0.33\textwidth}
\begin{tikzpicture}
\begin{axis}[enlargelimits=false,width=\textwidth]
\addplot graphics [
xmin=0,
xmax=50,
ymin=0,
ymax=150,
] {example-image-a};
\end{axis}
\end{tikzpicture}
\end{subfigure}
%
\begin{subfigure}[t]{0.33\textwidth}
\begin{tikzpicture}
\begin{axis}[enlargelimits=false,width=\textwidth]
\addplot graphics [
xmin=0,
xmax=50,
ymin=0,
ymax=150,
] {example-image-b};
\end{axis}
\end{tikzpicture}
\end{subfigure}
%
\begin{subfigure}[t]{0.33\textwidth}
\begin{tikzpicture}
\begin{axis}[enlargelimits=false,width=\textwidth]
\addplot graphics [
xmin=0,
xmax=50,
ymin=0,
ymax=150,
] {example-image-c};
\end{axis}
\end{tikzpicture}
\end{subfigure}
\end{figure}
\lipsum[1]



width=\textwidthto theaxisoptions? Or is that insufficient? – Torbjørn T. Jan 23 '17 at 15:50tikzpicturedoesn't seem to fit well the subfigure width. – Diaa Jan 23 '17 at 16:15%after the first two\end{subfigure}s. And yes, thewidthsetting ofpgfplotsis only approximate, as it doesn't actually measure the width of the ticklabels/axis labels. You could\resizeboxit, though that isn't ideal. – Torbjørn T. Jan 23 '17 at 16:42ikzpictures span the wholetextwidthwith control over the spacing between them. – Diaa Jan 23 '17 at 17:07