The latest version of RExcel has
Insert current R plot on the context menu.
This is only available if an R plor exists, of course.
You can check the source code to see how it is implemented.
It does some trickery about colors and frames.



On Nov 18, 2008, at 1:16 PM, Vilmos Prokaj wrote:

Hi,

I dont know wether this the good solution for you or not, but for your
last idea

I thought of using a image control instead of the
StatConnectorGraphicsDevice control.

 Dim sconn As StatConnector
 Set sconn = New StatConnector
 sconn.Init "R"

* sconn.EvaluateNoReturn "windows(4,4)"*
 sconn.EvaluateNoReturn "plot(sin(1:10))"
*conn.EvaluateNoReturn "savePlot(file="""", type = ""wmf"")"*
 sconn.Close

*IN VB**
*Image1.Picture = Clipboard.GetData(vbCFMetafile)*

the following can help. There is a win.metafile device in R which writes directly to file (or clipboard if filename is "") so your code should be
like this
sconn.EvaluateNoReturn "win.metafile(""""",4,4)"
sconn.EvaluateNoReturn "plot(sin(1:10))"
sconn.EvaluateNoReturn "dev.off()"

and finally

Image1.Picture = Clipboard.GetData(vbCFMetafile)

I did not test this last line. I used Ctrl-V on an Excel worksheet, and it
worked, so the image is copied to the clipboard by the above method.


--
Vilmos Prokaj
Eötvös Loránd University,
Department of Probability and Statistics
Pázmány Péter sétány 1/C
Budapest, 1117
Hungary

e-mail:[EMAIL PROTECTED]

_______________________________________________
Rcom-l mailing list
Rcom-l@mailman.csd.univie.ac.at
http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l
More information (including a Wiki) at http://rcom.univie.ac.at


--
Erich Neuwirth
Didactic Center for Computer Science and Institute for Scientific Computing
University of Vienna




_______________________________________________
Rcom-l mailing list
Rcom-l@mailman.csd.univie.ac.at
http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l
More information (including a Wiki) at http://rcom.univie.ac.at

Reply via email to