Introduction

If you ever asked yourself whether it's possible to present the information in a non-standard way in SAC, - this is the blogpost for you!

In this brief blogpost we will present the way of doing alternative kind of charts that are entertaining and can actually be quite useful, even in a business context.

Besides, we do have Halloween coming at us shortly, - don't we... ;-)

The list of the Unicode characters that can be applied to the plotting symbols in R Widget can be found here:  https://www.alanwood.net/unicode/miscellaneous_symbols.html

The pumpkin raster graphic that will be used in one of the charts originates from this source:  https://iconarchive.com

The data that is depicted in that chart can be found here:  https://de.statista.com/statistik/daten/studie/640501/umfrage/erntemenge-von-speisekuerbissen-in-deutschland/

Standard scatterplot of an explosive process

Below you can see the standard scatterplot that depicts the dependency of the pressure applied on the container walls as a result of heating up (temperature) the explosive substance inside of the container:

The pressure data set is an internal data set available per default in R, so no extra data loading is required to facilitate this chart.

The source code, which does the trick is quite simple and is visible in the side panel of the R Widget.

The graph is sufficient in itself, one can clearly see the exponential nature of the heating process pertaining to the pressure applied on a container and, thus, inevitably leading to the explosion.

But what can we do to emphasize this circumstance?

Let us make use of the Unicode characters - supported by the R environment - as point characters or plotting symbols and make the whole situation (the dependency of the pressure from the temperature or the heating process) more obvious to the target audience! :-)

The plot above does indeed a very good job at conveying the hazard associated with the substance!

It's definitely guaranteed that this graphical representation will linger in the memory of the audience it was presented to. ;-)

The plotting symbols are not randomly enlarged, but are rather sized proportionally to the values on the Y axis (pressure), thus, emphasizing the exponential nature of the underlying hazard.

It's literally visible how the risk of explosion soars as the temperature increases.

The source code for this depiction is in the screenshot below.

The part of the source code where the magic (Unicode characters) happens is highlighted:

Pumpkin harvest in Germany through the previous years

Indeed, Halloween is not Halloween without a pumpkin somewhere in between! :-)

And this can actually be achieved within the SAC R Widget as well.

Though, this time I would prefer a complex raster image as the plotting symbol as opposed to the fancy Unicode character.

For this purpose I have downloaded the pumpkin PNG icon from the source given in the introduction side panel above.

It's important to translate this PNG into the matrix of the hexadecimal values all starting with the '#' symbol as seen in the source code below:

One can basically discern that single raster pixels are now represented as a matrix of characters all starting with the '#' symbol as is convenient for the R representation of the hexadecimal values.

Each of these hexadecimal values is in fact a value for the color of that particular pixel.

This matrix is subsequently assigned to the 'icon' variable.

One can easily do this kind of transformation of the raster picture into the character matrix using i.e. on-line conversion tools or terminal conversion routines, including the desktop R engine itself using as.raster() and rasterImage() functions.  ;-)

To find out more, simply search the documentation on the internet for those commands. 

The code snippet below shows how this character matrix of hexadecimal values (icon) is read into a variable (icon2) and used as a plotting symbol within the rasterImage() function:

Below is the result of that source code:

The underlying data for the harvest volume in tones recorded for a particular year in Germany are taken from the source mentioned in the introduction side panel and look as follows: 

Conclusion

I hope this brief tutorial has helped you to get acquainted with different possible plotting techniques available in the R programming environment and which can actually be used in the R Widget within the SAP Analytics Cloud Business Intelligence Solution.

Some may argue that such things are rather unnecessary in the business context, however, those techniques could still be used if the Emphasis of the underlying data is an important part of the information that one wants to convey or make obvious.

All things considered: Have fun while Plotting!  :-)