/ Python And R Data science skills: 23 histograms in ggplot R language Telugu

Tuesday 24 April 2018

23 histograms in ggplot R language Telugu


-----------------------------------------

movie<-read.csv("Movie-Ratings.csv")
colnames(movie)<-c("Film","Genre","CriRating",
                   "AudRatining","BMill","Year")

movie$Year<-factor(movie$Year)
head(movie)
summary(movie)
library(ggplot2)



######## mapping and setting
r<- ggplot(data=movie,
           aes(x=CriRating,y=AudRatining))
r

r + geom_point()

######## mapping
r + geom_point(aes(color=Genre))
r + geom_point(aes(color="DarkGreen"))
#Setting
r + geom_point(color="DarkGreen")

r + geom_point(aes(size=BMill))
r + geom_point(size=BMill)
r + geom_point(size=5)
r + geom_point(aes(size=25))
# Histogram and density Charts
s<- ggplot(data=movie,
           aes(x=BMill))
s+geom_histogram()
s+geom_histogram(binwidth=20)
s+geom_histogram(binwidth=10,fill="Green")
s+geom_histogram(binwidth=10,aes(fill=Genre))
s+geom_histogram(binwidth=10,aes(fill=Genre),
                 color="black")
s+geom_density()
s+geom_density(aes(fill=Genre))   
s+geom_density(aes(fill=Genre),position = "stack")             
###############
t <- ggplot(data=movie)
t + geom_histogram(binwidth=10,
                   aes(x=AudRatining),
                   fill="white",
                   color="Blue")
t + geom_histogram(binwidth=10,
                   aes(x=CriRating),
                   fill="white",
                   color="Blue")

1 comment: