3

I'm preparing figures for a paper. The following command gives me a figure like this:enter image description here The question is I only need one colorbar. So the right colorbar should be delete. I've tried to delete the colorbar of the right image in MATLAB. But it will give me an image larger than the left one. And it's difficult to make them same.

I was wondering whether there is a way to hide the colorbar of the right image just like the crop operator in word.

Thank you so much.

\documentclass[a4paper,varwidth]{standalone}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\thispagestyle{empty}

\begin{document}
\begin{figure}
\begin{subfigure}{.33\textwidth}
  \includegraphics[width=\linewidth]{uxfea.eps}
  \end{subfigure}
  \begin{subfigure}{.33\textwidth}
  \includegraphics[width=\linewidth]{ux800cub04.eps}
    \end{subfigure}
  \end{figure}
\end{document}

1 Answer 1

5

Option trim together with clip help:

\documentclass[a4paper,varwidth]{standalone}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\thispagestyle{empty}

\begin{document}
\begin{figure}
\begin{subfigure}{.33\textwidth}
  \includegraphics[width=\linewidth]{uxfea.eps}
  \end{subfigure}
  \begin{subfigure}{.33\textwidth}
  \includegraphics[width=\linewidth, trim=0 0 2cm 0, clip]{ux800cub04.eps}
    \end{subfigure}
  \end{figure}
\end{document}

The amount (the example uses 2cm) depends on your figure. The default unit for the values in trim is bp. The four values mean trimming from left, bottom, right, and top.

3
  • But the rectangle after trim would be larger than the left rectangle. How can I adjust this?
    – Windy
    Commented Jun 27, 2015 at 4:54
  • Thank you so much! I decrease the width of the second subfigure after using trim. Now they look the same. @Heiko Oberdiek
    – Windy
    Commented Jun 27, 2015 at 5:02
  • @Windy The width of the image can be derived from the %%BoundingBox comment in the EPS file (unit is bp). Then the correct parameters for the subfigure width can be calculated to get the same scaling factors. Also an option is using scale instead of width in \includegraphics to set and get the same scaling factor. Commented Jun 27, 2015 at 5:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .