title: R: log transform linear fit of geom_smooth
body: <p>I am trying to make a graph with logarithmic x-axis and normal scaled y-axis with ggplot2 in R. This all works fine, but when I add a smoother with model="lm", I get problems.<br>
  What I would like is to fit a linear model through my data <strong>before</strong> the log transformation and then have it log transformed, thus the line fitted by geom_smooth should be curved instead of straight. I have found a way to do this with <code>coord_trans(x="log10")</code>, but if I do it this way the tick marks of the x-axis are all messed up.</p>
  
  <p>What I have so far is this:  </p>
  
  <pre><code>require(ggplot2)
  require(colorspace)
  require(scales)
  
  C&lt;-c(221562500,22156250,2215625,221562.5,360000000,36000000,3600000,360000)
  OD400&lt;-c(1.304,0.130,0.011,0.001,2.095,0.231,0.020,0.001)
  OD700&lt;-c(0.991,0.100,0.007,0.000,1.452,0.179,0.012,0.000)
  mydata&lt;-data.frame(C,OD400,OD700)
  
  p&lt;-ggplot() +
    geom_point(data=mydata,aes(x=C,y=OD400,colour="red")) +
    geom_point(data=mydata,aes(x=C,y=OD700,colour="green")) +
    scale_colour_manual("Wavelength", breaks=c("red","green"), labels=c("400 nm","700 nm"),
                       values=rainbow_hcl(2,c=80,l=60)) +
    scale_x_continuous(trans = log10_trans(),
                       breaks = trans_breaks("log10", function(x) 10^x),
                       labels = trans_format("log10", math_format(10^.x))) +
    annotation_logticks(sides="tb") +
    labs(x="Concentration [conidia/mL]",y="Absorption") +
    theme_bw() +  theme(panel.grid.minor = element_blank())
  </code></pre>
  
  <p>What I would like to add is:</p>
  
  <pre><code>p&lt;-p + geom_smooth(data=mydata,aes(x=C,y=OD400),method="lm")
  p&lt;-p + geom_smooth(data=mydata,aes(x=C,y=OD700),method="lm")
  </code></pre>
  
  <p>But <strong>before</strong> the log transformation and have the curves fitted be log transformed as well.</p>