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: 
Hi Guys

in this blog post we will discuss about the R visualization in SAC .

In SAP Analytics cloud we can create many charts using the R visualization using the R library files. In this blog we will discuss some basic charts which we can create using library ggplot2.

We will create basic bar chart using ggplot (grammar of graphics plot) library. in a story we can add new R visualization chart and then we have to configure the input data and input parameters and we have to add the script.



The add script section is where we have to write the following  script  and preview section to preview the chart.We will create simple bar chart.

  1. Bar Chart


The sample set data set i have taken the product sales details in this the X - axis column is product and the Y axis is the Gross sales and using the library ggplot we can create a geom_bar chart.

 


library(ggplot2)
df= sample_set_1
x=sample_set_1$'Product'
y=sample_set_1$'Gross sales'
ggplot(df,aes(x,y))+geom_bar(stat="identity", color="black", fill="green")

The color used is black and the fill color is Green this can be changed based on the chart.

2. Scatter Plot

The next chart is scatter plot we can use the same library ggplot2 and we have to use the type geom_point to plot the scatter plot.


library(ggplot2)
df= sample_set_1
x=sample_set_1$'country'
y=sample_set_1$'units sold'
ggplot(df,aes(x,y))+geom_point(color='#56b4e9', size=10)

3. Box Plot

The next chart is Box plot  which help to visualize the distribution of quantitative values in a field using the same library.

 


 

library(ggplot2)
df= sample_set_1
x=sample_set_1$'year'
y=sample_set_1$'sales price'
ggplot(df,aes(x,y))+geom_boxplot(color='black', fill='yellow')

Here the X - axis is Year and the Y axis is sales price and geom_boxplot function  to plot box plot the color and fill we can change as per requirement.

The box are used to find the outliers .

We can see further more charts in the upcoming blogs .

Thanks for reading.

Reference

https://blogs.sap.com/2020/06/08/r-visualizations-in-sap-analytics-cloud/
Labels in this area