[R] R: Including R plots in a Microsoft Word document
Mahmoud K. Okasha
m.okasha at palnet.com
Sat Feb 21 01:15:15 CET 2004
Greetings,
Thank you Gabor for your great explanation. I feel ok with it.
Best regards..
Mahmoud
.
----- Original Message -----
From: "Gabor Grothendieck" <ggrothendieck at myway.com>
To: <m.okasha at palnet.com>; <pauljohn at ku.edu>; <r-help at stat.math.ethz.ch>
Sent: Saturday, February 21, 2004 2:04 AM
Subject: Re: [R] R: Including R plots in a Microsoft Word document
>
>
> Perhaps some additional explanation is in order. There are
> two basic classes of format:
>
> - vector graphics such as windows metafile (wmf) and svg where
> the actual structure of the drawing is stored. Editing these
> can be done with no loss of resolution and you can access
> the individual components of the plot, the titles, the points,
> etc. directly.
>
> - bitmapped (also called raster) graphics such as jpg and png
> where the drawing is stored as a sequence of pixels. You can't
> access the individual objects in a plot with raster graphics since
> the image is just a set of pixels. Resizing involves a loss of
> resolution.
>
> Windows metafiles are the preferred format for Word. They
> are vector graphics, not raster, and they can be edited from
> within Word directly -- you don't need another editing program.
> This should be much easier than using bmp or jpg together with
> Photoshop.
>
> You can either generate wmf files by right clicking the plot and
> copying to the clipboard or using R code like this:
>
> win.metafile("/myfile.wmf")
> plot(1:10)
> dev.off()
>
> followed by Insert | Picture | File in Word.
>
> In Paul's case he is generating his images in Linux, where I gather
> Windows metafiles are not available, but in your case everything
> is on Windows so you should not have that problem.
>
> ---
> Date: Sat, 21 Feb 2004 00:38:37 +0200
> From: Mahmoud K. Okasha <m.okasha at palnet.com>
> [ Add to Address Book | Block Address | Report as Spam ]
> To: Paul Johnson <pauljohn at ku.edu>, <r-help at stat.math.ethz.ch>
> Subject: Re: [R] R: Including R plots in a Microsoft Word document
>
>
> Hello,
>
> I first would like to thank all of you for your great ideas. However, I
> agree with Paul particularly in that the answer is more complicated than
> other people make it seem when you have many graphs. I am trying all the
> ideas. It seems that all of them work but with some difficulties. I have
> Windows 2000 and MS Office 200. It seems to me that the easiest way of
> solving the problem is through saving the file in Bmp or Jpeg format and
> edit it in a graphic program such as Photoshop then insert it in the file.
I
> will continue trying all methods to find the easiest.
>
> Best regards
> Mahmoud
>
>
> ----- Original Message -----
> From: "Paul Johnson" <pauljohn at ku.edu>
> To: <r-help at stat.math.ethz.ch>
> Sent: Friday, February 20, 2004 9:47 PM
> Subject: Re: [R] R: Including R plots in a Microsoft Word document
>
>
> > I have wrestled with this problem a lot. I use Linux, coauthors use
> > Windows, and the eps files I make from R don't work with MS Word. Well,
> > the don't ever have "previews" and they sometimes won't print at all
> > when I use CrossOver Office with MS Office 2000 in Linux. My coauthor
> > says he can often wrestle my eps files into word on his system with
> > Office 2003. People keep telling me to use gsview to insert the preview
> > panes into eps files, and that does work, but more than one half of the
> > time my system creates eps files that look significantly worse than the
> > originals. Sometimes it inserts a blank page at the top of the eps or
> > it reshapes a figure. I don't care enough about MS to try to track that
> > down. It just pisses me off.
> >
> >
> > As a result, I think the answer is more complicated than other people
> > make it seem.
> >
> > I don't think it does any good to output a pdf file because, as I
> > learned yesterday, MS Word users can't import a pdf file into a doc.
> >
> > Clearly, if you are an MS windows user of R, you can save graphics in
> > the windows meta format (wmf) (or is it enhanced meta format, emf?).
> > That will go more or less seamlessly into Word. If you have a chance to
> > boot into Windows, and you really must make an image that works well
> > with Word, then you should boot into Windows, run your R in there and
> > make the wmf file.
> >
> > If you are a Linux/Unix user, and you are too proud to use Windows, the
> > problem is much more difficult to deal with.
> >
> > If you are ABSOLUTELY SURE that your image does not need to be resized
> > in any way, you could output from R into a picture type format, such as
> > png. As long as the image does not need to resized in any way, that
> > will be fine. If it is resized, then all bets are off.
> >
> > I find that the R output to the xfig format is quite good and I can edit
> > files in xfig. You can edit those files, add text, so its very very
> > handy. So right now I'm looking for a good bridge from xfig format to
> > Word. But I just started investigating that.
> >
> > uaca at alumni.uv.es wrote:
> >
> > >On Fri, Feb 20, 2004 at 05:54:33PM +0200, Mahmoud K. Okasha wrote:
> > >
> > >
> > >>Greetings List,
> > >>
> > >>I am conducting some large simulations using R. As a result, I get
many
> plots but I'm having some trouble with including some of them in a
Microsoft
> Word document. Can any one tell me the easiest method of having copies of
> the R-graphs in the Word documents?
> > >>
> > >>
> > >
> > >R can produce at least PostScript, PDF, png, jpeg/jpg
> > >
> > >see:
> > >
> > > help(postscript)
> > > help(pdf)
> > > help(png)
> > > help(jpeg)
> > >
> > >I don't use word, for me the PostScript format (more precisely
> Encapsulated
> > >PostScript/.eps) is the best/more easy/powerful format if you don't
have
> thousands of
> > >points or lines :-)
> > >
> > >por instance, to print a simple plot:
> > >
> > >postscript(file="somefile.eps");
> > >
> > >plot(whatever);
> > >
> > >dev.off(); <<---- Important
> > >
> > >other formats are similar
> > >
> > >regards
> > >
> > > Ulisses
> > >
> > >
> > > Debian GNU/Linux: a dream come true
> >
>
>---------------------------------------------------------------------------
> --
> > >"Computers are useless. They can only give answers." Pablo
> Picasso
> > >
> > >Humans are slow, innaccurate, and brilliant.
> > >Computers are fast, acurrate, and dumb.
> > >Together they are unbeatable
> > >
> > >---> Visita http://www.valux.org/ para saber acerca de la <---
> > >---> Asociación Valenciana de Usuarios de Linux <---
> > >
> > >______________________________________________
> > >R-help at stat.math.ethz.ch mailing list
> > >https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > >PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> > >
> > >
> >
> >
> > --
> > Paul E. Johnson email: pauljohn at ku.edu
> > Dept. of Political Science http://lark.cc.ku.edu/~pauljohn
> > 1541 Lilac Lane, Rm 504
> > University of Kansas Office: (785) 864-9086
> > Lawrence, Kansas 66044-3177 FAX: (785) 864-5700
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> >
>
>
> _______________________________________________
> No banners. No pop-ups. No kidding.
> Introducing My Way - http://www.myway.com
>
>
More information about the R-help
mailing list