Skip to Content
Technical Articles
Author's profile photo Dipak yadav B K1727

R Visualization in SAP Analytics Cloud

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.


df= sample_set_1
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.

df= sample_set_1
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.



df= sample_set_1
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.


Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.