Using geom_abline() and ggplot
<p>I am a beginner in <code>ggplot2</code>--it's been only 4 days since I have started experimenting with it. So, I apologize if this question sounds too basic. I'd appreciate any guidance--I've been struggling with this issue for about an hour.</p>

<p>I was experimenting with using <code>geom_abline()</code> as below:</p>

<pre><code> p &lt;- ggplot(mpg, aes(cty, hwy)) + geom_point()
 p + geom_abline() + facet_wrap(~cyl)
</code></pre>

<p>This works as in I can see a reference line in all four faceted graphs as below:</p>

<p><a href="https://i.stack.imgur.com/VZGTv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VZGTv.png" alt="enter image description here"></a></p>

<p>Later, I was using another related dataset <code>mtcars</code> to see what happens to <code>geom_abline()</code></p>

<pre><code>  p &lt;- ggplot(mtcars, aes(wt, mpg)) + geom_point()
     p + geom_abline() + facet_wrap(~cyl)
</code></pre>

<p>However, when I ran this command, I couldn't see <code>geom_abline().</code> Quite surprisingly, I found similar version of above command in the help file, and it says "<em><code>geom_abline()</code> is out of the range</em>"</p>

<p>While I know what "out of range" means, but how do I know whether in a particular dataset, <code>abline()</code> will be out of range? I can override it by forcing it to use a specific slope and an intercept, but then I'd consider this a bit of hacking--i.e. modifying the code after seeing the output. Is there any way I can know what happens behind the scenes for <code>geom_abline()</code></p>

<p>Here's the graph I got without any <code>abline()</code>s
<a href="https://i.stack.imgur.com/o25Fh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/o25Fh.png" alt="enter image description here"></a></p>

<p>I'd appreciate any thoughts. I am really confused.</p>