Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm a beginner with LaTex and writing an article in it (letter-sized). WinEDT and MikTeX (versions seen in the log).

I have a PNG chart (obtained from R/ggplot2) which is 471 x 335 pixels and which I'm including as below.

The problem: in the PDF the image is scaled up to occupy the width of the page and thus becomes blurry. I see the warnings in the log, but am not sure what I need to do given it's a picture, not text.

\geometry{top=1.0in, bottom=1.0in, left=1.5in, right=1.0in}
  \includegraphics{chart}\\                            % line 35 
  \caption{Adjusted Relative Risk (RR)}\label{mylabel} % line 36

The output log shows:

Command Line:   texify.exe --pdf --tex-option=--synctex=-1 "C:\Documents and Settings\myself\Application Data\WinEdt Team\WinEdt 6\RW\test1.tex"
Startup Folder: C:\Documents and Settings\myself\Application Data\WinEdt Team\WinEdt 6\RW

This is pdfTeX, Version 3.1415926-1.40.10 (MiKTeX 2.8)
entering extended mode

("C:/Documents and Settings/myself/Application Data/WinEdt Team/WinEdt 6/RW/test1.tex"
Babel  and hyphenation patterns for english, dumylang, nohyphenation, ge
rman, ngerman, german-x-2009-06-19, ngerman-x-2009-06-19, french, loaded.
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(C:\MiKTeX\tex\latex\base\size12.clo)) (C:\MiKTeX\tex\generic\babel\babel.sty
* Local config file bblopts.cfg used
(C:\MiKTeX\tex\generic\babel\english.ldf (C:\MiKTeX\tex\generic\babel\babel.def
))) (C:\MiKTeX\tex\latex\graphics\graphicx.sty
Package: `setspace' 6.7 
("C:\Documents and Settings\myself\Application Data\WinEdt Team\WinEdt 6\RW\t
est1.aux") (C:\MiKTeX\tex\context\base\supp-pdf.tex
[Loading MPS to PDF converter (version 2006.09.02).]
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
[1{C:/MiKTeX/pdftex/config/pdftex.map}] [2]
Overfull \hbox (39.14508pt too wide) in paragraph at lines 35--36

Underfull \hbox (badness 10000) in paragraph at lines 35--36

[3] [4 ] [5]
("C:\Documents and Settings\myself\Application Data\WinEdt Team\WinEdt 6\RW\t
est1.aux") )
(see the transcript file for additional information)
Output written on test1.pdf (5 pages, 100528 bytes).
SyncTeX written on test1.synctex
Transcript written on test1.log.
share|improve this question

4 Answers 4

up vote 7 down vote accepted

This is not exactly an answer to the question you asked, but do you know that R/ggplot2 can write out your charts as pdf files that can be \includegraphicsed? Just use pdf() instead of png() when setting up the output device, or if you're using ggsave(), give the file a .pdf extension instead of png. Then you get real text and vector graphics, which pdfTeX can scale without blurriness. Note: the width and height arguments to pdf() are in inches, not pixels. Also, you may have to delete the .png file to get pdfTeX to pick up the PDF.

share|improve this answer
Zack's advice is sound. Generating a pixel-based image that is intended for printing is just asking for trouble. Even if you get it looking fine on your printer, many publishers use high resolution typesetting systems, and the final result will then fail to live up to expectations. –  András Salamon Aug 5 '10 at 18:15
Thanks, I think that this should be the best practice as opposed to specifying the size. I'll update my preferred answer to be your suggestion. –  wishihadabettername Aug 6 '10 at 15:42

You could write


if the image has a resolution of 300 dpi etc. Perhaps it has a higher resolution but the standard value is 72 dpi. Or save it with setting 72 dpi.

share|improve this answer
To explain a bit further, it is quite common for png files to miss out vital information in the file. So TeX works with standard values, which can give these unexpected results. –  Joseph Wright Aug 5 '10 at 17:04
Indeed, the resolution was 94 in this case. The PNG was missing it because it. I added it and the size is correct now, but in the PDF it's still blurry (most obvious in the legend of the chart which, being in small font, is not anti-aliased). Is there an extra setting to add? Thanks. –  wishihadabettername Aug 5 '10 at 17:28
At a second thought, I'll ask my 2nd problem stated in the comment above in a separate question and reference this one. –  wishihadabettername Aug 5 '10 at 17:46

You can specify the printed width: \includegraphics[width=2in]{chart}

share|improve this answer

What Geoff said, additionally you can specify the height, or even both: \includegraphics[width=5cm,height=5cm]{chart}

That being said, if you use only one of them graphicx (the package providing the \includegraphics macro) will take care of maintaining the proper aspect ratio.

share|improve this answer
Thanks. I cannot yet vote this up. –  wishihadabettername Aug 5 '10 at 17:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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