title: Draw a logarithmic curve on graph in R
body: <p>I have the following set of data and when plotted has a curvilinear relationship</p>
  
  <pre><code>Fish.species.richness   Habitat.Complexity  log.habitat
  17  0.6376  -0.1954858
  13  0.2335  -0.6317131
  30  0.2866  -0.5427238
  20  0.3231  -0.4906630
  22  0.1073  -0.9694003
  25  0.2818  -0.5500590
  2   0.2182  -0.6612448
  4   0.0189  -1.7246886
  19  0.2960  -0.5287083
  25  0.5507  -0.2590849
  29  0.2689  -0.5704900
  21  0.6286  -0.2016602
  18  0.1557  -0.8078509
  24  0.6851  -0.1642460
  30  0.5059  -0.2959353
  32  0.4434  -0.3532043
  29  0.3585  -0.4455108
  32  0.5920  -0.2276783
  </code></pre>
  
  <p>When I log the x axis and do a linear regression to find the intercept and slope I am able to add a line that fits the data:</p>
  
  <pre><code>summary(lm(Fish.species.richness~log.habitat,data=three))
  
  plot(three$log.habitat,
   three$Fish.species.richness,
   xlab='Log Habitat Complexity',
   ylab='Fish Species Richness')
  abline(29.178,13.843)
  </code></pre>
  
  <p>However when I then do a curvilinear regression and try to plot the curve it doesn't fit the data, where am I going wrong?</p>
  
  <pre><code>mod.log&lt;-lm(Fish.species.richness~log(Habitat.Complexity),data=three)
  
  plot(three$Habitat.Complexity,
   three$Fish.species.richness)
  abline(mod.log)
  </code></pre>