embedding a R animated 3D plot in PowerPoint

十年热恋 提交于 2019-12-03 05:48:29

It is possible if you transfer the Powerpoint presentation (or, even more R-ish, use beamer/latex), and embed the 3D-plot as described in Luke Tierney's article

http://homepage.stat.uiowa.edu/~luke/R/misc3d/misc3d-pdf/misc3d-pdf.pdf

If you put this in to an HTML document, you can probably use the IWebBrowser2 object to open the HTML inside a Slide. I am not sure how a 3d graphic would render, and I'mnot familiar with R or would not be able to offer any further advice, but you might start by trying to simply create a WebBrowser object inside your slide, and then tell it to Navigate to the HTML file.

Sub InsertHTMLFrame()
Dim sld as Slide
Dim shp as Shape
Dim wb as Object
Set sld = ActivePresentation.Slides(1) '## Modify as needed

'## Create the shape container, you will need to modify the L/T/W/H to fit your document
Set shp = sld.Shapes.AddOLEObject(100, 200, 200, 150, _
    "Shell.Explorer.2")
shp.Name = "3dgraphic"
Set wb = shp.OLEFormat.Object

wb.Navigate "C:\Users\you\Desktop\exported3dgraphic.html"
End Sub

Controlling this flow during SlideShow mode may be a little trickier, but it's doable, provided the graphic renders properly through IE like this.

How to Install This Macro

  1. Open your PowerPoint Presentation, and click Alt+F11 to bring up the Visual Basic project.
  2. Right-click the project in the left pane, and Insert Module:

  1. Paste the code from my answer in to this module.
  2. In the line that says wb.Navigate "C:\..." modify this to the correct file path for your HTML file. This can be on your computer or in a shared network folder, etc.

The browser should be able to display HTML pages when in SlideShow mode, but will not render them in the normal or preview mode.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!