[Tex/LaTex] Included png appears too big in PDF

graphicspdftexpng

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.

\documentclass[12pt]{article}
\usepackage[letterpaper]{geometry}
\geometry{top=1.0in, bottom=1.0in, left=1.5in, right=1.0in}
\usepackage{graphicx}
\begin{figure}
  \includegraphics{chart}\\                            % line 35 
  \caption{Adjusted Relative Risk (RR)}\label{mylabel} % line 36
\end{figure}

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"
LaTeX2e 
Babel  and hyphenation patterns for english, dumylang, nohyphenation, ge
rman, ngerman, german-x-2009-06-19, ngerman-x-2009-06-19, french, loaded.
(C:\MiKTeX\tex\latex\base\article.cls
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\latex\00miktex\bblopts.cfg)
(C:\MiKTeX\tex\generic\babel\english.ldf (C:\MiKTeX\tex\generic\babel\babel.def
))) (C:\MiKTeX\tex\latex\graphics\graphicx.sty
(C:\MiKTeX\tex\latex\graphics\keyval.sty)
(C:\MiKTeX\tex\latex\graphics\graphics.sty
(C:\MiKTeX\tex\latex\graphics\trig.sty)
(C:\MiKTeX\tex\latex\00miktex\graphics.cfg)
(C:\MiKTeX\tex\latex\pdftex-def\pdftex.def)))
(C:\MiKTeX\tex\latex\geometry\geometry.sty
(C:\MiKTeX\tex\generic\oberdiek\ifpdf.sty)
(C:\MiKTeX\tex\generic\oberdiek\ifvtex.sty)
(C:\MiKTeX\tex\latex\geometry\geometry.cfg))
(C:\MiKTeX\tex\latex\base\flafter.sty)
(C:\MiKTeX\tex\latex\setspace\setspace.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.

Best Answer

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.