title: Creating a composite plot using ggplot in R
body: <p>I am pretty new to R and am trying to create a composite plot using ggplot. I have searched how to do this and have seen I can use the facet function, however, it seems that this is for plotting data which can be split by type e.g. male/female. I have a data frame and I want to plot recovery against concentration, and recovery against equilibrium time on separate plots but as a composite plot. For this I have the following code:</p>
  
  <pre><code>p1 &lt;- ggplot(dat2, aes(x = EqmTime, y = Recovery))
  limits &lt;- aes(ymax = Recovery + RecoveryError, ymin=Recovery - RecoveryError)
  
  p1 + geom_point(size = 4) + geom_errorbar(limits, width=4) + geom_smooth(method = "lm", se = FALSE, colour="gray", size=1.5, linetype="dashed") +
  labs(x='Equilibrium Time (hrs)', y='Nitrate Recovery (%)') + theme_bw() +
    theme(axis.line = element_line(colour = "black"),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank()) 
  
  p2 &lt;- ggplot(dat2, aes(x = StockConc, y = Recovery))
  limits &lt;- aes(ymax = Recovery + RecoveryError, ymin=Recovery - RecoveryError)
  
  p2 + geom_point(size = 4) + geom_errorbar(limits, width=0.1) + geom_smooth(method = "lm", se = FALSE, colour="gray", size=1.5, linetype="dashed") +
    labs(x='Concentration (g L-1)', y='Nitrate Recovery (%)') + theme_bw() +
    theme(axis.line = element_line(colour = "black"),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank(),
      panel.background = element_blank())
  </code></pre>
  
  <p>Additionally, I also have a problem that I cannot get the '-1' in the x axis label of plot 2 as a superscript, and am having trouble setting axis limits. When I set, for example, xlim=20-180, the axis doesn't start and finish at these, but makes these the major tick marks.</p>
  
  <p>I would greatly appreciate any help with this! I know some of these issues have been addressed in other posts but I cannot seem to use this advise to sort the issue here.</p>