dadrivr
2010-Sep-15 14:38 UTC
[R] Creating publication-quality plots for use in Microsoft Word
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! -- View this message in context: http://r.789695.n4.nabble.com/Creating-publication-quality-plots-for-use-in-Microsoft-Word-tp2540676p2540676.html Sent from the R help mailing list archive at Nabble.com.
Bryan Hanson
2010-Sep-15 14:50 UTC
[R] Creating publication-quality plots for use in Microsoft Word
There's many ways to solve this, but you are close to one already: Make the pdf, put the cursor where you want it in the document, then on the menu bar Insert --> Picture --> From File... And navigate to the file. This works on the Mac, and seems to store the picture internally in a different way that selecting the graphic in a viewer and cutting and pasting. Quality is top-notch and the graphic is clickable to be resized (and retains it's quality). HTH. Bryan ************* Bryan Hanson Professor of Chemistry & Biochemistry DePauw University, Greencastle IN USA On 9/15/10 10:38 AM, "dadrivr" <dadrivr at gmail.com> 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!
Gabor Grothendieck
2010-Sep-15 14:53 UTC
[R] Creating publication-quality plots for use in Microsoft Word
On Wed, Sep 15, 2010 at 10:38 AM, dadrivr <dadrivr at gmail.com> 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!Those are all bitmapped formats. For best quality you want a vector-based format. This link here discusses the difference: http://web.archive.org/web/20070221152152/http://www.stc-saz.org/resources/0203_graphics.pdf Microsoft's metafile formats are vector formats that work well in Word. Try savePlot with type = "wmf" or type = "emf" as the argument or right click a graphic in R and choose one of the metafile options. -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
Abhijit Dasgupta, PhD
2010-Sep-15 19:39 UTC
[R] Creating publication-quality plots for use in Microsoft Word
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