title: ggplot2 Grouping histogram bars
body: <p>I have some problems with grouping the bars of my histogram.</p>
  
  <p>This is part of the dataset:</p>
  
  <pre><code>data &lt;- structure(list(Color = structure(c(1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L), .Label = c("blue", "red"), class = "factor"),
                         Group = structure(c(1L, 1L, 2L, 2L, 3L, 3L, 3L, 3L), .Label = c("Group1", "Group2", "Group3"), class = "factor"),
                         ID = structure(1:8, .Label = c("A1", "A2", "B1", "B2", "C1", "C2", "D1", "D2"), class = "factor"), 
                         Value = c(194L, 1446L, 0L, 17L, 77L, 2565L, 223L, 61L)), 
                    .Names = c("Color", "Group", "ID", "Value"), class = "data.frame", row.names = c(NA, -8L))
  </code></pre>
  
  <p>I build the histogram as follow:</p>
  
  <pre><code>ggplot(data, aes(ID, Value)) + geom_bar(aes(fill = Color), position = "dodge", stat="identity") + scale_fill_manual(values=c("Blue", "Red"))
  </code></pre>
  
  <p>Now I would group the bars of the histogram by the variable Group, but I found it impossible using facet_wrap:</p>
  
  <pre><code>ggplot(data, aes(ID, Value)) + geom_bar(aes(fill = Color), position = "dodge", stat="identity") + scale_fill_manual(values=c("Blue", "Red")) + facet_wrap(. ~ Group)
  </code></pre>
  
  <blockquote>
    <p>Error in layout_base(data, vars, drop = drop) : 
        At least one layer must contain all variables used for facetting.</p>
  </blockquote>
  
  <p>It would be just as fine having the groups spaced from each other.</p>
  
  <p>How can I do that? Someone can help me?</p>