6

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.
7

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.

  • I think it should be "left of=img1" rather than "left=of img1", etc. Also, the anchor seems superfluous – Joel Wallman Sep 26 '17 at 21:40
  • @JoelWallman [S G speaking] A minor indication with respect to Joel Wallman comment, the syntax "left = of Img1" is correct and required for right placements. – user156344 Mar 16 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.