2014-10-10 92 views

回答

1

我已经想通了把图像到Spotfire的伎俩。如果你遵循这些指示并不困难,但是它的完成方式与你猜测你在Spotfire中做到的方式完全不同,这就是为什么我花了一段时间才弄清楚的原因。

下面是如何做到这一点的概述。您可以创建一个DocumentProperty,它是一个二进制对象,您可以编写一些Spotfire代码,为该文档属性赋予一个值,并使用“标签”类型的Spotfire属性控件显示该二进制对象。

令人困惑的部分是,您根本不使用Spotfire“插入图像”工具,并且根本不使用在Spotfire中的R代码内生成的文件名。一旦您习惯了这样的想法,即您认为在Spotfire中可以解决这个问题的两种最明显的方式完全没有用处和错误,那么您可以取得一些进展。

我会留下spiderplot细节,因为代码很长。

这就是你要做的。

1)类型“二进制”的Spotfire中创建文档属性,例如,“imageThatGoesBackToSpotfire” 2)你写生成的图像,并将其写入到文件中的一些R代码里面:

# get a temporary directory name on the local machine. You wouldn’t need to do this is you were just 
# going to run it on your own, but you need to do it if you intend to let anybody else run it on their own machine. 
tempfilebase = tempfile() 
# take the tempfilebase and prepend it to a filename. 
myFilename<-“someFileName.jpg” 
myFullFilename <- paste(tempfilebase,myFilename,sep="") 
#open a jpeg 
jpeg(filename=myFullFileName) 
# generate the image, however you normally would in R 
plot(input) 
# close the file 
dev.off 
# open a connection to that file. 
myConnection<-file(myFullFileName,open=”rb”) 
imageThatGoesBackToSpotfire<- data.frame(r=readBin(myConnection, what="raw", n=(file.info(myFullFileName)$size))) 
close(myConnection) 

3 )在上面运行你的R脚本。选择一些列作为图的“输入”,并使R脚本将输出返回到“imageThatGoesBackToSpotfire”DocumentProperties。 4)在Spotfire中创建一个文本区域。 5)将一个属性控件插入“标签”类型的文本区域。 (点击下图中圈出的图标)。这会打开一个对话框,

+0

你让我们挂了......'这打开一个对话框'后,这是相当自我解释,但我没有声誉来完成你的答案。其余的答案正是我所需要的。 – EddyTheB 2015-04-07 10:15:03