To implement the ggplotly function using plotly package in R programming.
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.
#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)