title: overlapping line and bar charts at the dame time with ggplot
body: <p>Would like to overlap a line chart over a bar chart with ggplot.
  Say, V1, V2 are the data for the bar charts, and V3 shall be presented as line.
  How can I complete the subset and different geom at the same time?</p>
  
  <pre><code>library(data.table)
  library(ggplot2)
  set.seed(100)
  dat &lt;- data.frame(Axis=letters[1:10],V1=1:10, V2=runif(10, 1,10), V3=10:1)
  dat &lt;-melt(data,id.var="Axis",measure.var=c("V1","V2","V3"))
  </code></pre>
  
  <p>Would it be like this?</p>
  
  <pre><code>ggplot(dat, aes(x=Axis)) + 
  geom_bar(stat="identity", aes(, y= value[------]))+   # V1, V2 for bars
  geom_line(aes(y=value[-----))                         # V3 for line
  </code></pre>
  
  <p>I tried making the subset of V1, V2, and make a bar chart, but can't insent V3 as a line on the chart.</p>
  
  <p>Many thanks</p>
  
  <p>Thanks to @dash2, I slightly changed his code, and make it looks clearer.</p>
  
  <pre><code>ggplot(dat, aes(x = Axis)) + 
    geom_col(aes(y = V1), fill = "darkred", alpha = .5, width=0.4) + 
    geom_col(aes(y = V2), fill = "blue", alpha = .5, 
             position = position_nudge(x = 0.4),width=0.4) + 
    geom_line(aes(y = V3, group = NA))
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/qrGVb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qrGVb.png" alt="enter image description here"></a></p>