set.seed
(5642)
sample_data <-
data.frame
(name=
c
(
"Geek1"
,
"Geek2"
,
"Geek3"
,
"Geek4"
,
"Geeek5"
) ,
value=
c
(31,12,15,28,45))
library
(
"ggplot2"
)
library
(
"cowplot"
)
plot1<-
ggplot
(sample_data,
aes
(x=name, y=value, fill=name)) +
geom_bar
(stat =
"identity"
) +
theme
(legend.position =
"none"
)
plot2<-
ggplot
(sample_data,
aes
(x = name, y=value, fill=name)) +
geom_point
(
aes
(colour =
factor
(name)), size = 6)+
theme
(legend.position =
"none"
)
combined_plot<-
plot_grid
(plot1, plot2,ncol=2)
title <-
ggdraw
() +
draw_label
(
"Two Plots together with shared title"
,
fontface =
'bold'
,
x = 0,
hjust = 0,
size = 24,
)
plot_grid
(title, combined_plot ,ncol=1,rel_heights =
c
(0.1, 1))