| Products | Versions |
|---|---|
| Spotfire Enterprise Runtime for R | All |
TIBCO Enterprise Runtime for R (TERR) does not create graphics. However, you can call out to an open-source R installation to generate graphics using the RinR package. You can save the graph created in this way to a file, or you can pass the graph object back into Spotfire for display as a static graph.
library( RinR )
library( Sdatasets )
# If running from a Spotfire data function, you will need to
# set the path to your local open-source R installation.
# For example:
# pushPATH( "C:\\Program Files\\R\\R-3.3.2\\bin" )
graph <- RGraph(
expr =
{
par( mfrow = c(3, 2) )
plot(
lm( fuel.frame$Mileage ~ fuel.frame$Weight ),
which = 1:6,
ask = F )
},
data = list( fuel.frame = fuel.frame ),
display = FALSE
)
library( RinR )
library( Sdatasets )
if( ! dir.exists( "C:\\MyGraphicsTestDir" ) )
{
dir.create( "C:\\MyGraphicsTestDir" )
}
# If running from a Spotfire data function, you will need to
# set the path to your local open-source R installation,
# for example:
# pushPATH( "C:\\Program Files\\R\\R-3.3.2\\bin" )
graph <- RGraph(
expr =
{
png( file = "C:\\MyGraphicsTestDir\\myplot.png", bg = "transparent")
par( mfrow = c(3, 2) )
plot(
lm( fuel.frame$Mileage ~ fuel.frame$Weight ),
which = 1:6,
ask = F
)
dev.off()
},
data = list( fuel.frame = fuel.frame ),
display = FALSE
)
library( RinR )
library( Sdatasets )
# Set the path to your local open-source R installation:
pushPATH( "C:\\Program Files\\R\\R-3.3.2\\bin" )
graph <- RGraph(
expr =
{
par( mfrow = c(3, 2) )
plot(
lm( fuel.frame$Mileage ~ fuel.frame$Weight ),
which = 1:6,
ask = F )
},
data = list( fuel.frame = fuel.frame ),
display = FALSE
)
graph <- as.raw( graph )