wos<- read.csv("wos_otter.csv") str(wos) library(ggplot2) #Plot divided by region mytheme<-theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) min_y <- min(0) max_y <- max(60) wos_plot<-ggplot(wos, aes(x=Coastal_ecosystem_type, ..count..)) + geom_bar(aes(fill = Otter_population), position = "dodge") + scale_fill_manual(values = c("black", "grey"))+ scale_y_continuous(limits=c(min_y,max_y))+ theme_bw() +xlab("Coastal ecosystem type") + ylab("Number of studies")+ guides(fill=FALSE)+ ggtitle('A')+theme(plot.title=element_text(hjust=0)) + theme(text=element_text(size=16)) wos_plot wos_plot2<-ggplot(wos, aes(within_ecosystem_type, ..count..)) + geom_bar(aes(fill = Otter_population), position = "dodge")+ scale_fill_manual(values = c("black", "grey"))+ theme_bw() +xlab("Within ecosystem type") + ylab("Number of studies")+ ggtitle('B')+theme(plot.title=element_text(hjust=0)) + theme(legend.position = c(0.8, 0.8))+ guides(fill=guide_legend(title="Otter population"))+ theme(text=element_text(size=16))+ theme(axis.text.x = element_text(size=12)) wos_plot2 # ggsave(p, filename = "otter_wos.pdf", width=12, height=6)#### WOS Figure pdf("otter_wos.pdf", width=14, height=6) gridExtra::grid.arrange(wos_plot, wos_plot2,nrow = 1, ncol=2) dev.off()