Custom R Component – Interactive 3D Plot
This component adds an interactive 3D plot to SAP Predictive Analysis. Three measures are displayed in three dimensions and the user can look at the data from any angle.
Disclaimer
Please note that this component is provided as-is without any guarantee or support.
Prerequisites
– R library rgl must be installed.
– The component expects two columns in the dataset that specify the color and the data label. If these columns are not available, they can be added with a formula component.
Limitations
– Once the chart has been displayed, the component’s configuration has to be changed (ie change any of the measures) to display the chart again.
Usage
These parameters can be set by the user.
Parameter | Description |
---|---|
X Axis | Numerical column to be displayed on the x axis. |
Y Axis | Numerical column to be displayed on the y axis. |
Z Axis | Numerical column to be displayed on the z axis. |
Color Column | Column for colour-coding individual datapoints. Can be numerical or text. |
Label Column |
Column that provides the labels for the datapoints. |
No output columns added by this component.
How to Implement
The component can be downloaded as .spar file from GitHub. Then deploy it as described here. You just need to import it through the option “Import/Model Component”, which you will find by clicking on the plus-sign at the bottom of the list of the available algorithms.
Example
You can try out the component wtih our own data or with the file EuropeanUrbanAudit_WithClusterAndGeocodes.csv. The dataset lists 75 European cities and their residents’ satisfaction with a number of aspects of life, ie the availabilty of good jobs, green spaces or affordable living. More information on this dataset is given in the article on hierarchical clustering. The result of that clustering is stored in a separate column in the attached file and will be used for the color-coding of the interactive 3D plot.
Just load your data in SAP Predictive Analysis, add the “Interactive 3D Plot” to your workflow and configure it:
Now run the component and the new window with the interactive chart opens up. Click with the mouse on the chart and look at the data from different angles.
When you are done with the chart just close the window. You will then be asked whether you want to jump to the tabular view of the data (“OK”) or whether you want to stay on the Designer view (“Cancel”).
Great job Andreas! Thanks for sharing,
Thanks Andreas! It is a very interesting work!
I had some problems in replicating this tutorial due to some problems on R settings. My problem is solved now. Hopefully this is also useful to others:
There were errors thrown out in SAP PA complaining about not being able to find the rgl package. I was sure rgl was installed to the R that PA uses as the R script runs ok in R. It turned out to be my R packages were installed to two different folders. For me they are %R_HOME%\library and %YOUR_HOME_DIRECTORY%\Documents\R\win-library\3.1. R can find libraries in both folders without any problem but PA can only find the packages installed to %R_HOME%library. The solution is to add both folders to set system environment variable
R_LIB=%R_HOME%\library;%YOUR_HOME_DIRECTORY%\Documents\R\win-library\3.1