title: In a ggplot2 geom_tile plot, is it possible to dodge the positions of tiles?
body: <p>I'm trying to produce a bar plot where the bars fade vertically according to a third variable, and I'm using geom_tile to enable this. However, I have multiple bars for a given category on the x-axis, and I'd like to dodge their positions to put alike x values together in groups of bars which don't overlap.</p>
  
  <p>Is it possible to use <code>position='dodge'</code> or similar with <code>geom_tile</code> and, if so, what's wrong with my syntax?</p>
  
  <pre><code>a &lt;- data.frame(x = factor(c(rep('a',5), rep('a',5), rep('b',5), rep('c',5))),
                  y = c(1:5, 1:5, 1:5, 1:5),
                  z = c(5:1, c(5,4,4,4,1), 5:1, 5:1)
                  )
  
  ggplot(a, aes(x = x, y = y, group = x)) +
    geom_tile(aes(alpha = z, fill = x, width = 1),
              position = 'dodge')
  </code></pre>
  
  <p>The example data frame <code>a</code> looks like this:</p>
  
  <pre><code>x y z
  1  a 1 5
  2  a 2 4
  3  a 3 3
  4  a 4 2
  5  a 5 1
  6  a 1 5
  7  a 2 4
  8  a 3 4
  9  a 4 4
  10 a 5 1
  11 b 1 5
  12 b 2 4
  13 b 3 3
  14 b 4 2
  15 b 5 1
  16 c 1 5
  17 c 2 4
  18 c 3 3
  19 c 4 2
  20 c 5 1
  </code></pre>
  
  <p>...and the resulting graph from the current code has no gaps between the x values, and the two where x is a are drawn on top of one-another:</p>
  
  <p><img src="https://i.stack.imgur.com/NIde2.png" alt="enter image description here"></p>
  
  <p>I want those two bars where x is 'a' to be drawn as separate bars.</p>
  
  <p>This is a mock-up of what I want the result to look like. The data are not correct for either of the a columns but it shows the grouping on the x-axis which is desired:</p>
  
  <p><img src="https://i.stack.imgur.com/ykWRy.png" alt="enter image description here"></p>