Graphics, Figures & TablesRemoving excess white space around figures

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Seanshine
Posts: 52
Joined: Sat Apr 28, 2018 9:59 pm

Removing excess white space around figures

Post by Seanshine »

Dear readers,

I am trying to fit in an .eps-formatted figure. However, there is excess white space between text and figure. Current code:

Code: Select all

%
\begin{figure}[H]
\hspace*{-0.6in}
\includegraphics[scale = 0.6]{Figures/rstar_analysis.eps}
\vspace*{-35mm}
\caption{Combined estimated paths of $r^{*}$}
\end{figure} \label{fig: 5.2}
%
I've also tried to use minipage, which was slightly better, but I did not really understand its use in this setting; and wrapfigure, which does not work with my current template settings.

I've been trying to figure this out for a long time, solutions appreciated!

PS. eps-file in the attachment.
rstar_analysis.eps
(17.92 KiB) Downloaded 533 times
Last edited by Seanshine on Sun Jul 08, 2018 5:19 pm, edited 2 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10334
Joined: Mon Mar 10, 2008 9:44 pm

Removing excess white space around figures

Post by Stefan Kottwitz »

Hi,

can you please post the .eps figure here, as attachment?

Stefan
LaTeX.org admin
Seanshine
Posts: 52
Joined: Sat Apr 28, 2018 9:59 pm

Removing excess white space around figures

Post by Seanshine »

Done
User avatar
Stefan Kottwitz
Site Admin
Posts: 10334
Joined: Mon Mar 10, 2008 9:44 pm

Removing excess white space around figures

Post by Stefan Kottwitz »

The white space is already in the original file, see the attached PNG, just converted.
rstar_analysis.png
rstar_analysis.png (12.07 KiB) Viewed 67767 times
Just cut the white space with a graphics editor, or better: generate the PS file without that white space in the original software. Or use \includegraphics with options such as trim.

Stefan
LaTeX.org admin
Seanshine
Posts: 52
Joined: Sat Apr 28, 2018 9:59 pm

Removing excess white space around figures

Post by Seanshine »

Apparently within the original software (R), it is not so easily achieved. Vector formatted files need specific software for editing, and is therefore not that straight forward. Would trim be an option? How does it work?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10334
Joined: Mon Mar 10, 2008 9:44 pm

Removing excess white space around figures

Post by Stefan Kottwitz »

It's explained in the graphicx manual, section 4.4 Including Graphics Files, have a look. Let me know (with code) if you try and it doesn't work.

Stefan
LaTeX.org admin
Seanshine
Posts: 52
Joined: Sat Apr 28, 2018 9:59 pm

Removing excess white space around figures

Post by Seanshine »

Final product:

Code: Select all

%
\begin{figure}[H]
\centering
\hspace*{-0.5in}
\includegraphics[width=7in, height=2.8in, trim = {0 1.6cm 0 1.5cm}, clip]{Figures/rstar_analysis.eps}
\vspace*{-3mm}
\caption{Combined estimated paths of $r^{*}$}
\end{figure} \label{fig: 6.1}
%
Post Reply