This uses the stackengine
package. Here, the x-axis label is centered horizontally, with the offset to the bottom of the label specified from the bottom of the graph. Likewise, the y-axis label is centered vertically, with the offset to the left of the label specified from the left of the graph.
EDITED to show that image aspect poses no problems; nor does math in label.
\documentclass{article}
\usepackage{stackengine,graphicx}
\begin{document}
\stackinset{l}{2pt}{c}{}{\rotatebox{-90}{This is my $y$-axis label}}{%
\stackinset{c}{}{b}{2pt}{This is my $x$-axis label}{%
\includegraphics[width=3in]{example-image-A}%
}}
\end{document}

If your graph has no blank region in which to apply the labels, \stackinset
can apply the labels outside of the image, by using negative offsets. However, in this case, make the y-axis label the innermost nested inset, because an inset that extends above or below the base content (as does the x-label) effectively changes the image height for subsequent insets. In contrast, extending out the left or right of the image does not change the effective width of the image.
\documentclass{article}
\usepackage{stackengine,graphicx}
\begin{document}
\stackinset{c}{}{b}{-12pt}{This is my x-axis label}{%
\stackinset{l}{-12pt}{c}{}{\rotatebox{-90}{This is my y-axis label}}{%
\includegraphics[width=3in,height=3in]{example-image-A}%
}}
\end{document}
