I can not find a solution for the following problem. I would appreciate help!
The following code creates charts using a facet. However, due to the "extra space" ggplot2 has in some groups, it makes the bars much wider, even if I specify a width of 0.1 or similar. I find it very annoying because it makes him very unprofessional. I want all the bars to look the same (except fill). Hope someone can tell me how to fix this.
Secondly, how can I change the order of different classes in facet windows so that the order is always C1, C2 ... C5, M, F, where applicable. I tried it with ordering factor levels, but since not all classes are present in every part of the graph, this did not work, or at least I assume that was the reason.
Thirdly, how can I reduce the space between the bars? So the whole graph is more compressed. Even if I reduce the image for export, R will reduce the size of the bars, but the gaps between the bars are still huge.
I would appreciate feedback for any of these answers!
My details: http://pastebin.com/embed_iframe.php?i=kNVnmcR1
My code is:
library(dplyr) library(gdata) library(ggplot2) library(directlabels) library(scales) all<-read.xls('all_auto_visual_c.xls') all$station<-as.factor(all$station) #all$group.new<-factor(all$group, levels=c('C. hyperboreus','C. glacialis','Special Calanus','M. longa','Pseudocalanus sp.','Copepoda')) allp <- ggplot(data = all, aes(x=shortname2, y=perc_correct, group=group,fill=sample_size)) + geom_bar(aes(fill=sample_size),stat="identity", position="dodge", width=0.1, colour="NA") + scale_fill_gradient("Sample size (n)",low="lightblue",high="navyblue")+ facet_wrap(group~station,ncol=2,scales="free_x")+ xlab("Species and stages") + ylab("Automatic identification and visual validation concur (%)") + ggtitle("Visual validation of predictions") + theme_bw() + theme(plot.title = element_text(lineheight=.8, face="bold", size=20,vjust=1), axis.text.x = element_text(colour="grey20",size=12,angle=0,hjust=.5,vjust=.5,face="bold"), axis.text.y = element_text(colour="grey20",size=12,angle=0,hjust=1,vjust=0,face="bold"), axis.title.x = element_text(colour="grey20",size=15,angle=0,hjust=.5,vjust=0,face="bold"), axis.title.y = element_text(colour="grey20",size=15,angle=90,hjust=.5,vjust=1,face="bold"),legend.position="none", strip.text.x = element_text(size = 12, face="bold", colour = "black", angle = 0), strip.text.y = element_text(size = 12, face="bold", colour = "black")) allp #ggsave(allp, file="auto_visual_stackover.jpeg", height= 11, width= 8.5, dpi= 400,)
The current chart that needs some fixing:

Thank you so much!