Overview

The significance of information visualization has been well-established over the last few years in the analytics and data science community. Owing to the wide variety of users and domains that are using data visualization, Spotfire offers multiple ways to create visualizations:

Out of Box menu Visualizations: Spotfire provides an extensive list of visualizations that the user can configure right out of box. These can be linked to show detailed drill downs, combined with data generated dynamically from TERR, and controlled through filtering and marking settings.

Customize using JavaScript in JSViz: Within the TIBCO Spotfire community, one area of discussion that crops up continually is that of novel visualization types. Customers often ask for a domain specific visualization type that Spotfire does not currently support. Others ask for simple customizations of existing visualizations, such as moving labels around, that sound straightforward but are almost impossible to implement without extensive coding, JSViz framework is a good solution to such queries.

Create Open Source R Visualizations in Spotfire: Spotfire supports TERR (TIBCO Enterprise Runtime for R) and Open Source R through Data Functions, but often a user would want to create an R graphics using say ggplot2 library in Spotfire. The bulk of this article will focus on how-to embed R Graphics in a Spotfire Dashboard.

Other methods to extend Spotfire visualizations may include working with Well Known Binary formats, particularly for Geoanalytics. These can be manipulated in data functions through TERR and plotted on map charts directly. TERR also includes options to create interactive plots in RStudio using libraries such as ‘ggvis’.

TIBCO Enterprise Runtime for R is a high-performance, enterprise-quality statistical engine to provide predictive analytic capabilities. TERR is available for integration into other applications through various APIs. Developing in R, and then deploying on TERR, lets you rapidly move from prototyping to production, without recoding and retesting your analyses.

Create a simple R graph in Spotfire

The package ‘RinR’ allows the user to run Open Source R code in TIBCO Enterprise Runtime for R or vice-versa. We’ll be making use of ‘RGraph’ function from ‘RinR’ to create a graphic in OSR and pass it to TERR to display in Spotfire.

This registers it to the list of data Functions. You can also save this to library

Connect Input and Outputs

Input - the data table:

Output - document property RGraphPackage:

Setup Display

In a text area include the Document Property RGraphPackage as a ‘Label’ type property control

This displays the resulting graph in a text area.

How the Script works

‘RGraph’ gets the graph from OSR in binary format that can then be stored as a binary value in a Document Property and displayed in a text area. ‘data’ is used to specify the data table being referenced within the graphing commands and ‘packages’ tells OSR which packages to invoke- this argument can take a vector.

Additional Examples

RinR can be used to rapidly prototype R models and display ggplot results as below or rapidly create color palettes for Spotfire.

Using RGraphics in webplayer

In the webplayer RinR would work via a TSSS instance that uses TERR as its statistical engine. Follow the steps to create RGraphics in Spotfire text areas in webplayer:

Download and install a compatible open-source R instance on the server that hosts the TSSS/TERR instance

Provide the path to that open-source R instance for use in calls to RinR::RGraph()

Any CRAN packages that are needed inside calls to RGraph() will need to be installed in the open-source R instance on the TSSS server

No additional CRAN packages are needed

The example in this public KB article can be used for testing the setup.

Advanced Configuration

Configure path to Open Source R

If you have multiple versions of open source R, it becomes inportant to tell RinR which one to invoke. This can be configured in the script through following exmple snippets:

How do I learn more?

This summarizes how to create R graphics in Spotfire. Watch the page and vote up to get notified about detailed updates. You could also request a featured session on any specific method from above on Dr. Spotfire by: