[R] Creating publication-quality plots for use in Microsoft Word

Abhijit Dasgupta, PhD adasgupta at araastat.com
Wed Sep 15 21:39:40 CEST 2010


  On 9/15/10 10:38 AM, dadrivr wrote:
> Hi everyone,
>
> I am trying to make some publication-quality plots for use in Microsoft
> Word, but I am having trouble creating high-quality plots that are supported
> by Microsoft Word.
>
> If I use the R plot function to create the figure, the lines are jagged, and
> the picture is not of high quality (same with JPEG(), TIFF(), and PNG()
> functions).  I have tried using the Cairo package, but it distorts my dashed
> lines, and the win.metafile results in a picture of terrible quality.  The
> only way I have succeeded in getting a high quality picture in a file is by
> using the pdf() function to save the plot as a pdf file, but all my attempts
> to convert the image in the pdf file to a TIFF or other file type accepted
> by Word result in considerably degraded quality.  Do you have any
> suggestions for creating publication-quality plots in R that can be placed
> in Word documents?  What packages, functions (along with options), and/or
> conversions would you use?  Thanks so much for your help!
Another option I've used is to export to PDF (which seems to give the 
best quality) and then use the (free) Imagemagick program to convert the 
PDF to high-resolution PNG. This worked for some involved heatmaps that 
were submitted to a journal. Imagemagick can be downloaded directly for 
Windows or via Cygwin.

Suppose your figure is in fig1.pdf. You can use the following command 
(once Imagemagick is downloaded and in your path):

system("convert -density 300x300 fig1.pdf fig1.png")



-- 

Abhijit Dasgupta, PhD
Director and Principal Statistician
ARAASTAT
Ph: 301.385.3067
E: adasgupta at araastat.com
W: http://www.araastat.com



More information about the R-help mailing list