I was referring to the following posts
1: Image with axis, [2]: pgfplots axis enlargelimits
I was trying to fit my image in a defined axis. Unfortunately, the image is not scaling correctly(aspect ratio always changes). The image is as below,(i take it as a pdf for my tikz picture)
MWE:
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%small,
axis equal image,
enlargelimits=false,
axis on top,
axis equal=false
]
\addplot graphics [xmin=0,ymin=0,xmax=10,ymax=2] {fig1.pdf};
\end{axis}
\end{tikzpicture}
\end{document}
And the not so MWE version(if needed)
%\documentclass{standalone}
%
%\usepackage{pgfplots}
%
%\begin{document}
% \begin{tikzpicture}
% \begin{axis}[
% axis on top,% ----
% width=5cm,
% scale only axis,
% enlargelimits=false,
% xmin=0,xmax=10,
% xlabel={Length($mm$)},
% xtick={0,2,4,6,8,10},
% xticklabels={0,2,4,6,8,10},
% scaled ticks=false,
% axis equal image,
% ymin=0,ymax=2,
% ylabel={Length($mm$)},
% ytick={0.1,0.5 ,1,1.5,2},
% yticklabels={0.1,0.5 ,1,1.5,2},
% axis equal=false,
% axis equal image,
% ]
%
% \addplot[thick,blue] graphics[xmin=0,ymin=0,xmax=10,ymax=2] {fig1.pdf};
% \end{axis}
% \end{tikzpicture}
%\end{document}


fig1.pdf, nobody but you can compile the code to diagnose or troubleshoot. – cfr Aug 17 '17 at 10:51axis equal imageandaxis equal=falsecancel, and neither is needed. If you want a specific aspect ratio, set the width and height usingscale axis only. – John Kormylo Aug 17 '17 at 16:06