[R] .eps files and powerpoint

Marc Schwartz marc_schwartz at me.com
Thu Jul 25 13:31:49 CEST 2013


Hi Duncan,

Based upon the subsequent exchange with Rich late yesterday, I could not replicate the problem that he was having with lattice (OSX versus Windows), so I don't believe that this is germane any longer. I also used trellis.device() just as an alternative to calling postscript() directly and did not have any issues either.

There is something else going on that has not become evident yet.

Thanks,

Marc


On Jul 24, 2013, at 5:40 PM, Duncan Mackay <mackay at northnet.com.au> wrote:

> Hi Marc
> 
> I sometimes had trouble with postscript and pdf files with lattice and I printed with trellis.device(device = pdf, ...) or trellis.device(device = postscript, ...)
> 
> I wonder if this is the case here
> 
> Duncan
> 
> Duncan Mackay
> Department of Agronomy and Soil Science
> University of New England
> Armidale NSW 2351
> Email: home: mackay at northnet.com.au
> 
> 
> At 03:22 25/07/2013, you wrote:
>> Hi Rich,
>> 
>> That's curious.
>> 
>> I noted that you are using barchart() below which is lattice versus base graphics. Is there any difference in the result on Windows if you use barplot() instead? If so, perhaps there is something about lattice graphics in this context.
>> 
>> Also, are you using Office 2008 or Office 2011 on your Mac? 2011 substantially improved Windows file format compatibility, not to mention a plethora of bug fixes.
>> 
>> Regards,
>> 
>> Marc
>> 
>> 
>> On Jul 24, 2013, at 11:37 AM, Richard M. Heiberger <rmh at temple.edu> wrote:
>> 
>> > Marc,
>> >
>> > very interesting.
>> >
>> > Your example works on Windows.  This example doesn't work on windows
>> >
>> >> postscript(file = "file2.eps", height = 4, width = 4,
>> > +                 horizontal = FALSE, onefile = FALSE, paper = "special")
>> >> barchart(1:3)
>> >> dev.off()
>> >
>> > Several examples, including the real one I was having trouble with
>> > previously, work on
>> > PowerPoint on Mac.  They don't work on PowerPoint in Windows.
>> >
>> > More: I put some eps figures into PP on Mac (where they work) and then
>> > saved the file and
>> > opened it in PP on Windows.  They don't work on Windows.
>> >
>> > Since Windows PP users are the target audience at the moment, I will stay
>> > with the res=300 png file.
>> >
>> > This is consistent with my other experiences with PP and Word for Mac,
>> > compared to PP and
>> > Word for Windows.  The two MS sets of programs are highly correlated, but
>> > far from identical.
>> >
>> > When people send my PP or Word files, I am more likely to open them first
>> > on the Mac side of my
>> > machine.  The graphs have spurious lines (connecting the end of the red
>> > line to the beginning of
>> > the green line, for example, when the two lines should be distinct).
>> > Alignment is different
>> > (two-line titles will get folded at the wrong place).  I need to move back
>> > to the Windows side in
>> > the VM to see the files as the author intended.
>> >
>> > Rich
>> >
>> >
>> > On Wed, Jul 24, 2013 at 12:16 PM, Marc Schwartz <marc_schwartz at me.com>wrote:
>> >
>> >> Hi Rich,
>> >>
>> >> Seems to work for me using Powerpoint in MS Office 2011 for Mac.
>> >>
>> >> I used the following code:
>> >>
>> >> postscript(file = "file.eps", height = 4, width = 4,
>> >>                horizontal = FALSE, onefile = FALSE, paper = "special")
>> >>
>> >> plot(rnorm(20))
>> >>
>> >> dev.off()
>> >>
>> >>
>> >>
>> >> Then I used the insert picture from file function in Powerpoint. It
>> >> created the PNG preview during import and I can see that on the slide in
>> >> the application without issue.
>> >>
>> >> I put the EPS file and the PPTX file up on DropBox if you want to look at
>> >> them:
>> >>
>> >> EPS File: https://www.dropbox.com/s/d8avze4yv51blso/file.eps
>> >>
>> >> PPTX file: https://www.dropbox.com/s/pm7oejm0g6rc0a5/RPlot.pptx
>> >>
>> >>
>> >> Regards,
>> >>
>> >> Marc
>> >>
>> >>
>> >>
>> >> On Jul 24, 2013, at 10:49 AM, "Richard M. Heiberger" <rmh at temple.edu>
>> >> wrote:
>> >>
>> >> Thanks Marc,
>> >>
>> >> the extra arguments to postscript still don't produce something that
>> >> PowerPoint will accept.
>> >> With your call, PP still displayed only the icon.  PP did not generate its
>> >> own png file.
>> >>
>> >> Since my immediate goal is the projection screen for a PowerPoint
>> >> presentation, I will go
>> >> directly to the png file.  For the proceedings and for paper I will
>> >> continue to use the pdf file.
>> >>
>> >> Rich
>> >>
>> >> On Wed, Jul 24, 2013 at 11:36 AM, Marc Schwartz <marc_schwartz at me.com>wrote:
>> >>
>> >>> Rich,
>> >>>
>> >>> You are missing some options in the call to postscript() below. It needs
>> >>> to be:
>> >>>
>> >>>  postscript(file = "file.eps", width = x, height = y,
>> >>>             horizontal = FALSE, onefile = FALSE, paper = "special")
>> >>>
>> >>> The first line needs to have values for 'x' and 'y' for the width and
>> >>> height of the image, as they default to 0.
>> >>>
>> >>> The second line of 3 options are all critical to producing an EPS file,
>> >>> as opposed to a PS file. This is described in the 4th paragraph of the
>> >>> Details section of ?postscript.
>> >>>
>> >>> If you import that file into any of the MS Office products (typically
>> >>> also for OpenOffce, LibreOffice, etc.), a PNG preview image will be created
>> >>> during import. It is the PNG bitmapped image that you can see when
>> >>> displaying the EPS file in the document, hence the degradation in quality.
>> >>> Some years ago, all you would see is a rectangular box with an "X" across
>> >>> it, as a placeholder for the imported image.
>> >>>
>> >>> Only if you then print the Office file using a Postscript printer driver,
>> >>> will you see the actual vector based EPS image. The target of that printing
>> >>> operation could be a printer for hard copy, a PS or a PDF file. MS Office
>> >>> does not support the rendering of the EPS image directly.
>> >>>
>> >>> If you are operating on Windows, as opposed to Linux or OSX, typically
>> >>> EMF/WMF files are the easiest way to go in terms of sticking R plots into
>> >>> an Office file, as they are also vector based images, but are effectively
>> >>> Windows only.
>> >>>
>> >>> Regards,
>> >>>
>> >>> Marc Schwartz
>> >>>
>> >>>
>> >>> On Jul 24, 2013, at 10:20 AM, Richard M. Heiberger <rmh at temple.edu>
>> >>> wrote:
>> >>>
>> >>>> png("png300.png", res=300, width=2880, height=1440)
>> >>>>
>> >>>> gives good behavior.  Thank you.  This will become my standard for
>> >>> export
>> >>>> to powerpoint.
>> >>>>
>> >>>> postscript(file='file.eps', onefile=FALSE)
>> >>>> produces eps files that powerpoint rejects, even though ghostview is
>> >>>> satisfied.
>> >>>>
>> >>>> Rich
>> >>>>
>> >>>>
>> >>>> On Wed, Jul 24, 2013 at 2:07 AM, Patrick Connolly <
>> >>>> p_connolly at slingshot.co.nz> wrote:
>> >>>>
>> >>>>> On Tue, 23-Jul-2013 at 10:23PM -0400, Richard M. Heiberger wrote:
>> >>>>>
>> >>>>> |> I have colleagues who use powerpoint.  When I send my colleagues pdf
>> >>>>> files
>> >>>>> |> or ps files, powerpoint
>> >>>>> |> rejects them.  Powerpoint does accept some eps files.
>> >>>>> |>
>> >>>>>
>> >>>>> [...]
>> >>>>>
>> >>>>> |> Does anyone know a workaround that will get vector graphics from R
>> >>> into
>> >>>>> |> powerpoint?
>> >>>>> |> win.metafile is not acceptable.  The resolution of emf files from R
>> >>> is
>> >>>>> |> worse than png files.
>> >>>>>
>> >>>>> Maybe worse than png files at the default resolution which is 72 dpi.
>> >>>>> Change that to something like 300 and nobody will see a jagged edge in
>> >>>>> a PowerPoint slide.
>> >>>>>
>> >>>>> HTH
>> >>>>>
>> >>>>>
>> >>>>> |>
>> >>>>> |> Thanks
>> >>>>> |> Rich
>> >>>
>> >>>
>> >>
>> >>
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > R-help at r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>> 
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list