title: stop bar plots from overlapping in ggplot
body: <p>I wish to have two different datasets positioned each other, like that when you have position="dodge" (area of erosion and deposition), and then plot two line graphs showing erosion and deposition rates for each reach. Right now, the area of deposition and erosion bar graphs are overlapping each other. I am able to get them to stack if I reorganise the data and plot it with geom_bar(position="dodge") (see right at the bottom), but in the process, my rates data get represented as a bar as well, which I do not want. Thank you in advance. </p>
  
  <p>This is my current graph:
  <a href="https://i.stack.imgur.com/jnrjL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jnrjL.png" alt="here"></a> 
  I wish to get something like this: 
  <a href="https://i.stack.imgur.com/sRQkG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sRQkG.png" alt="enter image description here"></a></p>
  
  <pre><code>
  EroDepoStuff &lt;- tibble::tribble(
                   ~Reach, ~Total.lateral.erosion, ~Total.lateral.deposition, ~Lateral.erosion.rate, ~Lateral.deposition.rate,
                "Reach 1",              44.818334,                  17.400127,             4.4818334,                1.7400127,
                "Reach 2",              91.865675,                   91.39827,             9.1865675,                 9.139827,
                "Reach 3",                7.40573,                  16.654819,              0.740573,                1.6654819,
                "Reach 4",              25.214554,                  52.084122,             2.5214554,                5.2084122,
                    "All",             169.304293,                 177.537338,            16.9304293,               17.7537338
                )
  
  EroDepoGraph &lt;- ggplot(EroDepoStuff,aes(x=Reach,group=4)) +
    geom_bar(aes(y=Total.lateral.erosion,fill="Lateral erosion"),position="dodge",stat="identity") +
    geom_point(aes(y=Lateral.erosion.rate*10,colour="Lateral erosion rate")) +
    geom_line(aes(y=Lateral.erosion.rate*10,colour="Lateral erosion rate")) +
    geom_bar(aes(y=Total.lateral.deposition,fill="Lateral deposition"),position="dodge",stat="identity")+
    geom_line(aes(y=Lateral.deposition.rate*10,colour="Lateral deposition rate")) +
    geom_point(aes(y=Lateral.deposition.rate*10,colour="Lateral deposition rate")) +
    labs(y="Area (sq km)") +
    scale_fill_manual(values=c("Lateral erosion"="skyblue4","Lateral deposition"="blue")) +
    scale_colour_manual(values=c("Lateral erosion rate"="violetred3","Lateral deposition rate"="tan1")) +
    labs(color = "", fill = "") 
  
  
  #adding second axis 
  EroDepoGraph &lt;- EroDepoGraph + scale_y_continuous(sec.axis = sec_axis(~./10,name = expression(paste("Rate (sq km/yr)"))))
  
  
  #formatting axes
  EroDepoGraph &lt;- EroDepoGraph + theme(
    axis.title.x = element_blank(),
    axis.title.y = element_text(size=11),
    axis.text.x = element_text(size=11,angle=90,hjust=1),
    legend.position="bottom", 
    legend.spacing.y = unit(-0.1, "cm"),
    plot.title = element_text(size=12, face="bold")
  )
  EroDepoGraph
  
  reOrganisedData &lt;- ReorderedData &lt;- tibble::tribble(
                        ~Reach,     ~Value,                      ~Type,
                     "Reach 1",  44.818334,    "Total lateral erosion",
                     "Reach 2",  91.865675,    "Total lateral erosion",
                     "Reach 3",    7.40573,    "Total lateral erosion",
                     "Reach 4",  25.214554,    "Total lateral erosion",
                         "All", 169.304293,    "Total lateral erosion",
                     "Reach 1",  17.400127, "Total.lateral.deposition",
                     "Reach 2",   91.39827, "Total.lateral.deposition",
                     "Reach 3",  16.654819, "Total.lateral.deposition",
                     "Reach 4",  52.084122, "Total.lateral.deposition",
                         "All", 177.537338, "Total.lateral.deposition",
                     "Reach 1",  4.4818334,     "Lateral erosion rate",
                     "Reach 2",  9.1865675,     "Lateral erosion rate",
                     "Reach 3",   0.740573,     "Lateral erosion rate",
                     "Reach 4",  2.5214554,     "Lateral erosion rate",
                         "All", 16.9304293,     "Lateral erosion rate",
                     "Reach 1",  1.7400127,  "Lateral deposition rate",
                     "Reach 2",   9.139827,  "Lateral deposition rate",
                     "Reach 3",  1.6654819,  "Lateral deposition rate",
                     "Reach 4",  5.2084122,  "Lateral deposition rate",
                         "All", 17.7537338,  "Lateral deposition rate"
                     )
  
  
  
  
  
  
  </code></pre>