I have asked nearly an identical question on here a few weeks back (LINK) and received a terrific response from Cookbook for R. It works beautifully. The only problem is I don't really understand what's happening in the function. Now I want to remove horizontal lines while still faceting and allowing scales="free"
in the facet_grid
function. I can't figure out how to alter the response to make it work for horizontal lines.
Here is some sample code to aid the discussion:
library(ggplot2)
set.seed(10)
CO3 <- data.frame(id=1:nrow(CO2), CO2[, 2:3],
outcome=factor(sample(c('none', 'some', 'lots', 'tons'),
nrow(CO2), rep=T), levels=c('none', 'some', 'lots', 'tons')))
CO3
x <- ggplot(CO3, aes(x=outcome)) + geom_bar(aes(x=outcome))+
facet_grid(Treatment~Type, margins='Treatment', scales='free')
x + theme_bw() + opts(axis.text.x=theme_text(angle= 45, vjust=1, hjust= 1))
I am, as always, very grateful for the help people give. Thank you in advance.