2014-10-10 97 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