# Create sample data
set.seed(5642)
sample_data1 <- data.frame(name=c("Geek1","Geek2","Geek3",
"Geek4","Geeek5") ,
value=c(31,12,15,28,45))
sample_data2 <- data.frame(x = rnorm(400))
sample_data3 <- data.frame(name=c("C++","C#","Java","R","Python") ,
value=c(301,112,115,228,145))
# Load ggplot2 and gridExtra
library("ggplot2")
library("gridExtra")
# Create both plot and store in variable
plot1<-ggplot(sample_data1, aes(x=name, y=value))+
geom_segment( aes(x=name, xend=name, y=0, yend=value), color="grey") +
geom_point( color="green", size=4)
plot2<-ggplot(sample_data2, aes(x = x)) +
geom_density(fill="#69b3a2", color="#e9ecef", alpha=0.8)
plot3<-ggplot(sample_data3, aes(x=name, y=value)) +
geom_bar(fill="#69b3a2", stat = "identity")
# Divide frame in grid using grid.arrange function
# and put above created plot int it
grid.arrange(plot1, plot2,plot3, ncol= 3)