Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support DrawingML format for output #183

Open
revodavid opened this issue Jun 29, 2015 · 0 comments
Open

Support DrawingML format for output #183

revodavid opened this issue Jun 29, 2015 · 0 comments
Labels

Comments

@revodavid
Copy link
Contributor

From r-devel on June 29

Dear all,
For vector-based output, PDF export of R graphs works well, but unfortunately Office on Windows provide poor support for PDF and importing & exporting to other formats using Inkscape can be buggy.
Enhanced metafile export in turn does not support transparency (also not in package devEMF - are there any plans to support this perhaps in the future?). And rasterising graphs to a PNG I often find dissatisfactory, as vector-based graphs should ideally stay in vector format, especially when it comes to axes and axes labels etc.
So this means that by default, there are rather few good options left to export all those beautiful R graphs in high-quality vector format.

I recently discovered that package ReporteRs provides near-perfect export of R graphs in fully editable vector format to Powerpoint or Word using the Office native DrawingML format, with full upport for transparency, in a much better quality than what is provided by default in grDevices. This made me wonder if exporting a graph to Powerpoint could perhaps also be supported in grDevices?

In ReporteRs the code e.g. to export a ggplot would be

library( ReporteRs )
require( ggplot2 )
mydoc = pptx( )
mydoc = addSlide( mydoc, slide.layout = "Title and Content" )
mydoc = addTitle( mydoc, "Plot examples" )
myplot = qplot(Sepal.Length, Petal.Length
, data = iris, color = Species
, size = Petal.Width, alpha = I(0.7)
)
mydoc = addPlot( mydoc, function( ) print( myplot ), vector.graphic=TRUE)
writeDoc( mydoc, file = "test plot.pptx" )

I was thinking it could be nice though to provide this capability also in base R - so that e.g.
windows()
plot(...)
File...Save as...would also provide an option to save as Powerpoint, with options for the width, height, font and font size used for export, or that there would be an extra command dev.copy2ppt or a combination of ppt ( ) and dev.off() to export to Powerpoint, using the code available in ReporteRs.

Especially for use in the classroom this would be super handy, as windows users are now pretty much tied to using bitmap-based PNG, thereby limiting the ease with which the final layout of R graphs can be edited !

best regards,
Tom Wenseleers

Prof Tom Wenseleers
University of Leuven
Naamsestraat 59
3000 Leuven, Belgium
https://bio.kuleuven.be/ento/wenseleers/twenseleers.htm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant