Skip to content

Charts to M$Word - what's the best format

23 messages · Ernesto Jardim, Ko-Kang Kevin Wang, Thomas W Blackwell +12 more

#
Hi

I'm exporting some graphs from R to M$Word. I used png, jpeg and bmp and
the quality is poor when comparing with the postscript.

What is the best way to export a chart to be included in a M$Word file ?

Thanks

EJ
#
On 14 Apr 2003, Ernesto Jardim wrote:

            
I'll assume you are using Word on Windows and not MacOS: Windows MetaFile,
or postscript if you have a postscript printer.
#
Hi

You're also assuming I'm in M$Windows, which I'm not. Anyway if I'm in
windows that is the best way ? What about exporting with R functions
like png() ? 

I thought these functions would be the best way of exporting charts.

Regards

EJ
On Mon, 2003-04-14 at 13:22, Ko-Kang Kevin Wang wrote:
#
On 14 Apr 2003, Ernesto Jardim wrote:

            
How do use use bmp if you are not?  Perhaps you would be so kind as to 
tell us

- What platform you are using R on?
- What platform you are using MicroSoft Word on?

and in future disclose such information in your first posting.
You assert, but you don't explain why and you don't like the results! If a
`chart' means a vector plot, it is pretty obvious that a vector graphics
format is best, and that means EMF, ps, PDF or SVG in the world of R
graphics drivers.  AFAIK Word does not support the last two.

  
    
#
Try Metafile.  You can copy the graph (I'm assuming you're using Rgui) as 
Metafile, then in Word, go to Edit -> Paste Special..., then paste as 
Enhanced Metafile.

This allows you to resize the plot in Word without losing its quality.
On 14 Apr 2003, Ernesto Jardim wrote:

            

  
    
#
Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:
With add-ons it might. I did some work with someone who had purchased
the relevant Adobe software, and things came out very nicely with R's
pdf plots. (Is there a "cheapskate" version of that involving
Ghostscript, maybe?)
#
On Mon, 2003-04-14 at 13:00, Prof Brian Ripley wrote:
I'm using R 1.6.2 in SuSE linux box. I promise not to forget this
information in my posts anymore. 

I've tried bmp in a machine with windows. Rigth now I'm in Linux and I
don't have a windows machine with me. However, as you know, I'm able to
see the bmp in linux and I can also print all these formats.

One of the major R features for me is the ability to use it in Linux or
windows without worry with platform issues. I want to produce some plots
that I can send to someone else, who uses M$Windows and M$Word (I don't
know what version).

So I made a simple question. What's the best way to export a chart from
R to be used in M$Word. The copy/paste doesn't help, but it's a good
information for a moment that I'll be working in R for windows.
I'm not asserting anything. I'm making a statement based on my
understanding and experience of R.

Open Source, as I see it, makes use of the users comments and opinions.
So if I have an opinion I'll post it, the R team is free to use it or
not. If it will contribute to a better R I'll be deligth to help,
otherwise it's just a few minutes I lose writing a message. 

I'm doing simple plot() and png(), bmp() and jpeg() are producing plots
with lower resolution. You can find the files here:

http://ernesto.freezope.org/cmf/r/plot.png
http://ernesto.freezope.org/cmf/r/plot.ps

if you want to see what I mean.
Regards

EJ
#
I think maybe the question is, how do you import postscript format
into an M$Word document.  I am NOT a word user, but I had to do this
some years ago and found that it IS possible to import postscript.

You do something like "import picture ... (some kind of generic-
sounding graphics format)", and it works fine.  The postscript
behaves very nicely once you get it in.  You have to play around
quite a bit, and try some very unlikely sounding possibilities to
get it in, but it WILL work.  There are definitely some shortcomings
in the documentation for M$Word (to put it charitably).

Other people will have more recent experience with this than I have.

-  tom blackwell  -  u michigan medical school  -  ann arbor  -
On 14 Apr 2003, Ernesto Jardim wrote:

            
#
On Mon, 14 Apr 2003, Thomas W Blackwell wrote:

            
It just works in modern versions of Word under Windows, provided you have
a postscript printer.  Insert | Picture | From file ... and select the
file.  What does not work well is the preview, if the PS file has one
(which R ones do not).

Our secretaries were doing this (with S-PLUS figures) a decade ago, and it 
worked the same way then.
#
Hello,

Even if you are using a Linux box, you can save your images in png, bmp or
jpeg formats which can be uploaded into Word without any problem, well for
png you should have installed your Word with that enhancement.

If you prefer to save your image as ps, you can convert it to whatever of
the previous formats with ImageMagick (command "convert") although the
resolution is lower than if you generate the image in png, bmp or jpeg
directly.

Hope it helps,
Carlos.


-----Mensaje original-----
De: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]En nombre de Ernesto Jardim
Enviado el: lunes, 14 de abril de 2003 15:27
Para: Prof Brian Ripley
CC: Mailing List R
Asunto: Re: [R] Charts to M$Word - what's the best format
On Mon, 2003-04-14 at 13:00, Prof Brian Ripley wrote:
I'm using R 1.6.2 in SuSE linux box. I promise not to forget this
information in my posts anymore.

I've tried bmp in a machine with windows. Rigth now I'm in Linux and I
don't have a windows machine with me. However, as you know, I'm able to
see the bmp in linux and I can also print all these formats.

One of the major R features for me is the ability to use it in Linux or
windows without worry with platform issues. I want to produce some plots
that I can send to someone else, who uses M$Windows and M$Word (I don't
know what version).

So I made a simple question. What's the best way to export a chart from
R to be used in M$Word. The copy/paste doesn't help, but it's a good
information for a moment that I'll be working in R for windows.
I'm not asserting anything. I'm making a statement based on my
understanding and experience of R.

Open Source, as I see it, makes use of the users comments and opinions.
So if I have an opinion I'll post it, the R team is free to use it or
not. If it will contribute to a better R I'll be deligth to help,
otherwise it's just a few minutes I lose writing a message.

I'm doing simple plot() and png(), bmp() and jpeg() are producing plots
with lower resolution. You can find the files here:

http://ernesto.freezope.org/cmf/r/plot.png
http://ernesto.freezope.org/cmf/r/plot.ps

if you want to see what I mean.
as
and
file ?

Regards

EJ

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

###  This email has been checked for all known viruses by the
###  Firstnet anti-virus system - http://www.firstnet.net.uk
###  Please email fav at firstnet.net.uk for details.


_____
The information in this email is confidential and it may not be\... {{dropped}}
#
On Mon, 14 Apr 2003 15:00:58 +0100 (BST)
Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:

            
I have never understood why more people don't use this approach.  Even without a postscript printer it is an excellent approach; you can install Adobe Acrobat Distiller and print to non-postscript printers (same with Ghostscript).
#
Frank E Harrell Jr wrote:

            
> Even without a postscript printer it is an excellent approach;
 > you can install Adobe Acrobat Distiller and print to non-postscript
 > printers (same with Ghostscript).

  I suspect (with very little evidence) that perhaps these people have 
tried with PostScript files and failed - since they should have been 
using Encapsulated PostScript files. Forget (or not understand the 
consequences) to put 'onefile=FALSE' when creating the file and you may 
well end up with something that mucks up when included in a document.

  Many applications produce very poor EPS files, and many other 
applications have trouble importing them. Thankfully for most technical 
people R generates very good EPS files and LaTeX/dvips imports them 
flawlessly.

  Anyway, now that machines are fast and disk space cheap, why cant 
Windows users just produce bitmaps at 600dpi? :)

Baz
#
format
postscript.
you
I think that part of the issue is how the Word (and related Office)
files will be used and by whom.  

If only by the person generating the file or immediate staff, such as
the scenario Prof. Ripley indicated, this is not a significant issue.

On the other hand, if you are going to send the file to a third party,
then there is the real challenge of the lack of portability to folks
without PS printing support and/or who don't like the lack of a PS
preview capability. At the risk of broad generalization, this is more
likely to be an issue with less technical folks and/or those who may
be in a industry business setting and may not have or may not be
comfortable with using third party or open source applications such as
GS/GSView.

For my own use, whether under Windows or Linux, I have the flexibility
of using whatever fits the task at hand, which may be PNG, PS or PDF
typically. I have GS/GSview installed under Windows, so I can go back
and forth easily. If I am printing the documents/graphics here (I use
an Oki 7400n color laser w/PS 3), then I have no other issues.

However, when I send Word or PowerPoint files with embedded graphics
to Windows based clients (which is almost all at this point), they
prefer it when I incorporate WMF graphics, which they can view and
print without using third party applications. WMF formats preserve
very reasonable quality and can be re-sized as needed, which
non-vector formats cannot be without losing image quality. They tend
to prefer this approach over using PDF files even after considering
the free availability of the Acrobat Reader. They want to be able to
open the attachment, see what they need to see, discuss it, perhaps
print it (not always) and move on. I consider this a "customer
service" requirement.

I suspect that this will change as more people become comfortable with
non-Windows platforms and open source applications, especially the
IS/IT support departments who will be "burdened" with the additional
training and support duties required by non-technical users. The
increasing adoption of OpenOffice (especially the next update version,
which will support the generation of PDF files) will also put
additional tools into the hands of mainstream Windows users and should
help broaden the options over time as companies look for ways to
reduce IS/IT costs by moving away from MS products.

Regards,

Marc Schwartz
#
m?ndagen den 14 april 2003 13.09 skrev Ernesto Jardim:
Hello,

As a Linux newbie I think a graphics device capable of producing the wmf 
(windows meta file) format wouldn't hurt - or is this a blasphemy in the 
Linux society?

Fredrik Lundgren

 > Hi
#
On Mon, 14 Apr 2003, Fredrik Lundgren wrote:

            
It would be nice.  We look forward to your contributing one.

It has been on the wishlist on developer.r-project.org for a couple of 
years at least, and no one has yet volunteered.
#
Fredrik Lundgren <fredrik.lundgren at norrkoping.mail.telia.com> writes:
Maybe, but mainly hard work. The file format would seem to be rather
well documented here:

http://www.csn.ul.ie/~caolan/publink/libwmf/libwmf/doc/ora-wmf.html

Even so, it's still a bit of a toss up whether it works. Microsoft's
track record in writing software that behaves according to their own
documentation is not impressive...

(It is amusing though, that the same people that wouldn't think twice
about sending you a Word file will whine horribly if *you* require
*them* to install any additional software to read your files. Even
though it's free.)
#
Fredrik Lundgren <fredrik.lundgren at norrkoping.mail.telia.com> writes:
Not blasphemy, but difficulty to find a good library to do it right
(vector rather than bitmap'd).  Hopefully, someone will care enough to
do both, right now apparently no one does (care enough -- enough
people care a small bit).

best,
-tony
#
No offence meant. To newbies nothing seems to be impossible for those who created the R system - but of course a little reflection reveals that even magicians can find some tricks more difficult to perform.

Fredrik
----- Original Message ----- 
From: "Prof Brian Ripley" <ripley at stats.ox.ac.uk>
To: "Fredrik Lundgren" <fredrik.lundgren at norrkoping.mail.telia.com>
Cc: "Ernesto Jardim" <ernesto at ipimar.pt>; "Mailing List R" <r-help at stat.math.ethz.ch>
Sent: Monday, April 14, 2003 7:47 PM
Subject: Re: [R] Charts to M$Word - what's the best format
#
On Mon, 14-Apr-2003 at 04:42PM +0200, Carlos Ortega wrote:
|> Hello,
|> 
|> Even if you are using a Linux box, you can save your images in png, bmp or
|> jpeg formats which can be uploaded into Word without any problem, well for
|> png you should have installed your Word with that enhancement.
|> 
|> If you prefer to save your image as ps, you can convert it to whatever of
|> the previous formats with ImageMagick (command "convert") although the
|> resolution is lower than if you generate the image in png, bmp or jpeg
|> directly.

I'm a little surprised that the bitmap function hasn't come up in this
discussion.  Its default res argument is too small for the purpose in
this discussion, but setting it to about 300 gives quite good results
that can be imported into Word for Windoze provided the machine has
more than 32 Meg RAM (which some people still try to work with).  The
main failing I've seen with it is that conversion of grey lines are
somewhat unsatisfactory, but colour files seem fine, with moderate
amounts of resizing possible.

If the plot is a lattice plot, I find it necessary to use a postscript
file and convert that to a png file using the Gimp with minimal
effort.  AFAIK, ImageMagick will not convert at a high enough
resolution otherwise that would be even simpler.

best
#
> Fredrik Lundgren
    > <fredrik.lundgren at norrkoping.mail.telia.com> writes:
    >> As a Linux newbie I think a graphics device capable of
    >> producing the wmf (windows meta file) format wouldn't hurt
    >> - or is this a blasphemy in the Linux society?

    > Not blasphemy, but difficulty to find a good library to do
    > it right (vector rather than bitmap'd).  Hopefully, someone
    > will care enough to do both, right now apparently no one
    > does (care enough -- enough people care a small bit).

I've been looking into the same issue lately.  It would be great
if there was a simple way to convert postscript to windows
metafiles, but I haven't been able to find anything.

There is a library called libemf (enhanced metafile library,
http://libemf.sourceforge.net/) that might do it - "pstoedit uses
this library for creating WMF/EMF files under non-Windows
systems."

Mike
#
mmiller3 at iupui.edu (Michael A. Miller) writes:
That is the one I'm thinking about as well -- it was okay last I
looked, supposedly better now, but still a bit of work.

best,
-tony
#
Ernesto Jardim <ernesto at ipimar.pt> wrote:
Patrick Connolly <p.connolly at hortresearch.co.nz> replied:
My magic line for exporting graphs from R on Solaris to PowerPoint on WinNT is:
   bitmap("myfile.png", type="png16m", height=8.5, width=11, res=300)

(The type="png16m" argument may help with the grey line problem.)  Good luck.
#
On Mon, 14 Apr 2003 11:38:26 -0700, you wrote in message
<87znmsx6u5.fsf at jeeves.blindglobe.net>:
I'm not sure it's worthwhile.  I've found WMF or EMF files don't look
nearly as good as Postscript or (high resolution) bitmap formats.  The
fonts get messed up, symbols change shape in strange ways, etc.  

Of course, I've sworn off using MS Word n times (and reluctantly gone
back n-1 times).  It's good for memos and such, but not good enough
for something containing math, or that you want to look good.

Duncan Murdoch