I have a table within my plot and I am looking to add a title to my table. Here is my code:
pl <- ggplot(artsci,aes(Preferred.Class.Year))
pl2 <- pl + geom_bar(aes(fill=Gender)) +
scale_x_continuous(breaks = seq(1908,2020,by=2)) +
scale_y_continuous(breaks=seq(0,40000,by=1000)) +
coord_flip() + theme_bw() +
scale_fill_manual(values = c('steelblue4','paleturquoise3'))+
labs(y='Count',x='Preferred Class Year') +
annotation_custom(tableGrob(minitbl,rows = NULL,theme = mytheme),
xmin=1940, xmax=1946, ymin=3500, ymax=3500)
print(pl2)
I've attached an image to show my result. I cannot find a solution to adding a title to my table. As a workaround, I've just added a row labeled as top class year but I do not want to stick with this. See image below