Research breakthrough possible @S-Logix pro@slogix.in

Office Address

Social List

How to implement ggplotly function using plotly package in R?

Description

To implement the ggplotly function using plotly package in R programming.

Process

Package and Function:

   R Package : plotly

   R Function :ggplot(x= , aes())

   R Function :geom_bar()

   R Function :ggtitle()

x -- Data Set

aes - Aesthetic mappings describe

   how variables in the data are mapped to visual properties (aesthetics) of geoms.

   Aesthetic mappings can be set in ggplot2() and in individual layers.

Sapmle Code

#Plotly Chart
#Loading required Packages
#install.packages(“plotly”)
library(“plotly”)

#Input Data Frame
input<-read.xlsx(“OnlineShopping”,sheetIndex = 1)

#ggploytly for Bar Chart
g<-ggplot(input,aes(age,income)) + geom_bar(aes(fill=commodity), stat = “identity”) + ggtitle(“Filler Bar Chart”)
ggplotly(g)

#ggplotly for grouped line Chart
g<-ggplot(input, aes(x=age, y = income)) + geom_line(aes(group = commodity, color = commodity,size=1))
ggplotly(g)

Screenshots
implement ggplotly function using plotly package in R
implement ggplotly function using plotly package in R
Input Data Frame