1

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.

Community
  • 1
  • 1
Tyler Rinker
  • 108,132
  • 65
  • 322
  • 519
  • 1
    You can find the solution how to hide the horizontal lines also in the Cookbook for R. Just look at the end of the Link i´ve posted in the thread. – EDi Mar 26 '12 at 18:29
  • EEDi I feel foolish for having overlooked that. I thought I recalled (incorrectly that there was not an answer on Rcookbook for horizontal line removal). Can you please submit your last comment as the answer to the question and I'll accept it? – Tyler Rinker Mar 26 '12 at 18:33

0 Answers0