## load plotly package
library(plotly)
## Loading required package: ggplot2
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
## load literate population by gender data of major Indian cities in 2001
Litpop <- read.csv("census.csv")
## Note: Plot has better view with Google Chrome
p <- plot_ly(data = Litpop, x = ~City, y = ~Population, color = ~Gender, type="bar") %>% layout(title = "Literate population of major Indian cities by gender", xaxis=list(title="City"), yaxis=list(title="Population"))
p
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels