[Tex/LaTex] Adding axes labels to LaTeX figures

minipageplotsubfloats

I have almost managed,

With this code:

\begin{figure}[htb]
\hspace*{-5cm}
\begin{minipage}{0.5cm}
\rotatebox{90}{\textcolor{red}{$y$-axis label}}
\end{minipage}%
\begin{minipage}{\dimexpr\linewidth-2.50cm\relax}%
\begin{minipage}{0.5cm}
\rotatebox{90}{\textcolor{red}{$y$-axis label}}
\end{minipage}%
  \raisebox{\dimexpr-.5\height-1em}{\includegraphics[scale=0.225]{MagneticTransport.pdf}}
\qquad
  \raisebox{\dimexpr-.5\height-1em}{\includegraphics[scale=0.25]{aspectratio.pdf}}

  \vspace*{0.1cm}\hspace*{2.0cm}\textcolor{red}{$x$-axis label}
   \vspace*{0.1cm}\hspace*{5.0cm}\textcolor{red}{$x$-axis label}
\end{minipage}%
\end{figure}

I get this:enter image description here

I would like:

  • To have the other 'y-label' next to the second graph, and
  • if possible, have the 'x-label' and 'y-label' centred underneath (on the side) of the plots.

Best Answer

A solution with tikzpicture:

\documentclass{article}
\usepackage{tikz}
\usepackage{graphicx}
\usetikzlibrary{positioning}


\begin{document}

\begin{figure}[htb]
\begin{minipage}{0.4\textwidth}
\begin{tikzpicture}
  \node (img)  {\includegraphics[scale=0.225]{example-image}};
  \node[below=of img, node distance=0cm, yshift=1cm,font=\color{red}] {x-axis};
  \node[left=of img, node distance=0cm, rotate=90, anchor=center,yshift=-0.7cm,font=\color{red}] {y-axis};
 \end{tikzpicture}
\end{minipage}%
\begin{minipage}{0.4\textwidth}
\begin{tikzpicture}
  \node (img)  {\includegraphics[scale=0.225]{example-image}};
  \node[below=of img, node distance=0cm, yshift=1cm,font=\color{red}] {x-axis};
  \node[left=of img, node distance=0cm, rotate=90, anchor=center,yshift=-0.7cm,font=\color{red}] {y-axis};
\end{tikzpicture}
\end{minipage}%
\end{figure}
\end{document}

enter image description here

And without minipages:

\begin{document}

\begin{figure}[htb]
\begin{tikzpicture}
  \node (img1)  {\includegraphics[scale=0.225]{example-image}};
  \node[below=of img1, node distance=0cm, yshift=1cm,font=\color{red}] {x-axis};
  \node[left=of img1, node distance=0cm, rotate=90, anchor=center,yshift=-0.7cm,font=\color{red}] {y-axis};
  \node[right=of img1,yshift=0.1cm] (img2)  {\includegraphics[scale=0.25]{example-image}};
  \node[below=of img2, node distance=0cm, yshift=1cm,font=\color{red}] {x-axis};
  \node[left=of img2, node distance=0cm, rotate=90, anchor=center,yshift=-0.7cm,font=\color{red}] {y-axis};
\end{tikzpicture}
\end{figure}
\end{document}

I had to replace your pdf files with the example-image of graphicx. Please try to provide a MWE in future questions.