I have an R script named plot.R
which reads data from a .txt file then creates a matrix which is then plotted using matplot
. My matplot
function is like that :
matplot(mymatrix,col=rainbow(3),lty=1,xaxt='n',yaxy='n',main='title')
axis(1,at=seq(1,dim(mymatrix)[1],by=1),labels=as.character(mylist))
axis(2,at=seq(floor(min(mymatrix)),ceiling(max(mymatrix)),by=0.05))
legend("topright",legend=c('name1','name2','name3'),col=rainbow(3))
some abline functions and some points displayed
My goal is too create a macro in VBA which launches the script via a Shell command (I'm using Windows, so a cmd) :
Dim wsh as Object
Set wsh = VBA.CreateObject("WScript.Shell")
wsh.Run "Pathname\myscript.cmd"
and the batch file is like this:
R CMD BATCH -slave mypath\plot.R
and I would like to display the plot created in my R script, if possible I would like to paste it (as a picture) in an Excel Worksheet.
How should I do this, keeping in mind that I would like my plot to look like it looks in R when I display it in fullscreen, so if possible without a reformatting ?