Further to my earlier question. Thank you to: John Maindonald, Ramon Diaz-Uriarte, Brian Ripley, Alvaro Novo, Simon Bond and David Scott for your helpful replies. I have looked at the problem in some more detail. I am using Rgui.exe Version 0.64.2 (July 3, 1999) running under Windows NT To demonstrate the problem, I run the program:> win.graph(width=5, height=3) > data(women) > plot(women)Then, in the graph window, I select the command Save as metafile using the right mouse button, and save the file in c:\temp\women2.emf Then, in Microsoft Word (97 SR 2) , I can import this file using Insert/Picture/FromFile When I do this, the picture is truncated to about 70% of its correct width and height. I have looked at the metafile produced by R, and can make it import correctly into Word by increasing the FrameRight and FrameBottom parameters (at offset 0020x and 0024x in the file) by a factor of 1.49. Using Copy as Metafile and the Paste in Word does the same as using an intermediate file, but with no chance to view or edit the emf file header. It looks to me as if there is a problem, either in the way that R calculates the Frame or Scaling parameters, or in the way that the Word import filter handles them. Is there any way I can change the Frame information that R puts in the emf file? Has anyone managed to get this to work nicely in Word - perhaps there is a Word configuration file that needs to be amended. I have attached the emf file, in case it is of use to any of you. Thanks for your help Tim Auton -- T R Auton PhD MSc C.Math Head of Biomedical Statistics Proteus Molecular Design Ltd Beechfield House Lyme Green Business Park Macclesfield Cheshire SK11 0JL UK email: tra at proteus.co.uk -------------- next part -------------- A non-text attachment was scrubbed... Name: women2.emf Type: application/x-unknown-content-type-emf_auto_file Size: 16136 bytes Desc: not available Url : https://stat.ethz.ch/pipermail/r-help/attachments/19990723/0971c366/women2.bin
> -----Original Message----- > From: owner-r-help at stat.math.ethz.ch > [mailto:owner-r-help at stat.math.ethz.ch]On Behalf Of tra > Sent: Freitag, 23. Juli 1999 12:20 > To: r-help at stat.math.ethz.ch > Subject: [R] Getting R graphics into MS Word (more) ><Snip> <\Snip> Tim, in respect to importing an emf directly to MS-Word you are probably out of luck. To put it mildly, the problem is mostly on the importing side. You can try indirect imports. If you have Corel Draw, you get better results. You graphics looks like the attached gif file. You can see, that the ordinate labeling is turned by 180 degrees. Usually, I get the best results by using the postscript output from R. You can display the postscript files with the Windows version of Ghostscript; this allows you to add a metafile preview that is usable by Word. Regards Karl -------------- next part -------------- A non-text attachment was scrubbed... Name: women2.gif Type: image/gif Size: 2098 bytes Desc: not available Url : https://stat.ethz.ch/pipermail/r-help/attachments/19990723/c233ac31/women2.gif
On Fri, Jul 23, 1999 at 11:19:46AM +0100, tra wrote:> > To demonstrate the problem, I run the program: > > > win.graph(width=5, height=3) > > data(women) > > plot(women) > > Then, in the graph window, I select the command > Save as metafile > using the right mouse button, and save the file in c:\temp\women2.emf > > Then, in Microsoft Word (97 SR 2) , I can import this file using > Insert/Picture/FromFile > > When I do this, the picture is truncated to about 70% of its correct > width and height. > > I have looked at the metafile produced by R, and can make it import > correctly into Word by increasing the FrameRight and FrameBottom > parameters (at offset 0020x and 0024x in the file) by a factor of 1.49. > > Using Copy as Metafile and the Paste in Word does the same as using an > intermediate file, but with no chance to view or edit the emf file > header. > > It looks to me as if there is a problem, either in the way that R > calculates the Frame or Scaling parameters, or in the way that the Word > import filter handles them. >I think I got the point and, as Tim confirmed using an updated R.dll, fixed it in the R-devel source. Problem was that Windows and R disagreed on the number of "reference pixels" of the metafile when metric information reported by Windows are inconsistent,i.e., Windows seems to compute the number of reference pixels using (number of pixels) and (dimension in mm of the screen), I used (pixels for inch) and on some systems, like Tim one, ((mm for inch)*wp)/wmm != ppi where wp = screen dimension in pixels, wmm = screen dimension in mm, ppi = pixels for inch. Just to give an example on Tim machine, rigth side was around 65, while left one was 96, which explain the 1.49 factor empirically determined by Tim. Strangely enough (pure Microsoft style?), the not coherent values for wp, wmm and ppi are all got from the same Win32 API function. Thanks to Tim Auton and Partha Bagchi for helping me in testing. guido -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._