title: ggplot2 — any way to automatically plot the different transformed-y on the same scatter plot, for you?
body: <p><strong>Q: Given a typical x,y scatter plot using ggplot(), can ggplot2  automagically plot the transformed y’s as well?</strong></p>
  <p><a href="https://imgur.com/a/NL0rSJG" rel="nofollow noreferrer">Example:  simple x,y scatter</a></p>
  <p>•  In this ex, using <code>stat_smooth(..)</code> feature in ggplot2 to have multiple lm-fits:</p>
  <pre><code>ggplot(df, aes(x=myX, y=myY)) +
  geom_point(color=‘darkgray’) + 
     stat_smooth(method=‘lm’, se=F, aes(color=‘black’), formula=“y ~ x”) +
     stat_smooth(method=‘lm’, se=F, aes(color=‘blue’), formula=“log(y) ~ x”) +
     stat_smooth(method=‘lm’, se=F, aes(color=‘green’), formula=“sqrt(y) ~ x”) +
  
     # log-scale it so transforms show up:
     scale_y_continuous(trans=‘log10’)
  </code></pre>
  <p>•  But I want to plot the scatters for the transformed y’s as well: <code>sqrt(y)</code> and<code>log(y)</code></p>
  <ol>
  <li><p><strong>Does ggplot2 have such an automagic feature to also plot these into the same plot?</strong></p>
  </li>
  <li><p>If not, what is the simplest recommended approach?  Is it to compute manually then <code>unstack</code> (base-R) or <code>melt</code> (reshaper2) them into a long-format?</p>
  </li>
  </ol>