Dear list, I am new with ggplot2 and I have spend quiet some time putting together the following code to create the attached plot. However there's still a few things that I'm having trouble with! I would be grateful if someone can tell me how to fix (1) the colour of my bars into grey scales (2) removing the y-axis (species name) on the right figure to avoid duplication, and (3) fix the width, such that both figures have the same apparence regardless of the legend.
Thank you very much in advance! The code is as follow: (a<-ggplot(Final2, aes(x=spp, y=CPUE, fill=season)) + geom_bar(position=position_dodge()) + geom_errorbar(aes(ymin=CPUE-cpue.se, ymax=CPUE+cpue.se), size=.3, width=.2, position=position_dodge(.9)) + xlab("Species") + scale_x_discrete(breaks=c("100","102","107","88","90","91","92","93","94","96","98","99"), labels=c("WINTER","SPINYTAIL","BIGELOW'S","SKATES (NS)","THORNY","SMOOTH","ABYSSAL","LITTLE","DEEPWATER","JENSEN'S","WHITE","SOFT")) + ylab("Abundance (fish/tow)") + coord_flip() + theme_bw() + opts(axis.title.x = theme_text(size = 10)) + opts(panel.grid.minor = theme_blank()) + opts(legend.position='none') ) (b<-ggplot(Final2, aes(x=spp, y=WPUE, fill=season)) + geom_bar(position=position_dodge()) + geom_errorbar(aes(ymin=WPUE-wpue.se, ymax=WPUE+wpue.se), size=.3, width=.2, position=position_dodge(.9)) + xlab(NULL)+ scale_x_discrete(breaks=c("100","102","107","88","90","91","92","93","94","96","98","99"), labels=c("WINTER","SPINYTAIL","BIGELOW'S","SKATES (NS)","THORNY","SMOOTH","ABYSSAL","LITTLE","DEEPWATER","JENSEN'S","WHITE","SOFT"))+ ylab("Biomass (Weight (kg)/tow)") + scale_fill_hue(name="Survey season", # Legend label, use darker colors breaks=c("summer", "winter"), labels=c("Spring", "Fall")) + coord_flip() + theme_bw() + opts(axis.title.x = theme_text(size = 10)) + opts(panel.grid.minor = theme_blank())) pdf("polishing-layout2.pdf", width = 10, height = 6) grid.newpage() pushViewport(viewport(layout = grid.layout(1, 2))) vplayout <- function(x, y) viewport(layout.pos.row = x, layout.pos.col = y) print(a, vp = vplayout(1, 1)) print(b, vp = vplayout(1, 2)) dev.off() Aurelie Cosandey-Godin Ph.D. student, Department of Biology Industrial Graduate Fellow, WWF-Canada Dalhousie University | Biology Dept. | 1459 Oxford Street |Halifax, NS | Canada B3H 4R2 Phone: 1-902-494-2478 | cell: 1-902-412-3404 |Fax: 1-902-494-3736 Email: god...@dal.ca | Skype: aureliegodinco | Web: wormlab.biology.dal.ca ---------------------------------------------------------------------------------------------------------------------------------------------------- Want to learn more about sharks in Atlantic Canada? Visit ShARCC! www.atlanticsharks.org ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.