Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
shruti_srivastava3
Participant
R Visualization in SAP Analytics Cloud can be used to create charts which are not directly available in SAP Analytics Cloud. In this blog I am explaining how to create an Increment and Decrement Indicator Arrow in SAP Analytics Cloud using R Visualization feature.

Step-1: Either create a new Story or open an existing story in edit mode. Navigate to “Insert” and click on “+” button. Click on “R Visualization”.

 


 


Step-2: Add the Model as Input Data in Builder.


 


Step-3: Click on “Add Script” in Builder.


Step-4: Expand the window.


Step-5: There are 4 panes in the window i.e. Editor, Environment, Console and Preview.

The R code is written in the Editor and then executed. Any error message is displayed in Console. If no errors, the visualization is displayed in Preview.

With R, many plotting symbols are available which can be be used using the graphical argument 'PCH'

Below is the list of available plotting symbols.


 





































































































PCH Point Symbol PCH Point Symbol
0  square 13 circle cross
1 circle 14 square and triangle down
2 triangle point up 15 filled square
3 plus 16 filled circle
4 cross 17 filled triangle point-up
5 diamond 18 filled diamond
6 triangle point down 19 solid circle
7 square cross 20 bullet (smaller circle)
8 star 21 filled circle blue
9 diamond plus 22 filled square blue
10 circle plus 23 filled diamond blue
11 triangles up and down 24 filled triangle point-up blue
12 square plus 25 filled triangle point down blue

The other arguments required to customize the symbols are as below.

col: Color to be used for points

bg: The background or Fill color for open plot symbols. It can be used only when pch = 21:25

cex: The size for pch symbols

lwd: The line width for the plotting symbols.

 

R Code for Increment/Decrement Indicator:

x<-c(1)

data1<-Sample_Model$`Profit 2020`

plot(x,xaxt='n',yaxt='n',

frame.plot=FALSE,ann=FALSE,

pch=ifelse(data1>=Sample_Model$`Profit 2019`,24,25),cex=20,

col=ifelse(data1>=Sample_Model$`Profit 2019`,"green","red"),

bg=ifelse(data1>=Sample_Model$`Profit 2019`,"green","red"),lwd=1)

 


 


 

 

Step-6: After submitting the code, the indicator is included in the story.


Usage:

The indicators can be further customized by including variance values as shown below. This helps provide more insight to the underlying data to the end users.

 


In similar ways, changing the pch values other indicators can be included in the SAC story.

 

Technical inputs shared by @Suvam Dey

References : http://www.sthda.com/english/wiki/r-plot-pch-symbols-the-different-point-shapes-available-in-r

 

 
8 Comments
Labels in this area