ggplot stat_density with facet_wrap and single stat_density doesn't match
<p>I have a df with 3 sector's wacc data. When I plot the density for one sector I get the real object. The energy sector wacc density plot:</p>

<p><img src="https://i.stack.imgur.com/upLHj.png" alt="energy sector wacc density"></p>

<p>But when I use the facet_wrap the density function is totally wrong, because I get the following graph:</p>

<p><img src="https://i.stack.imgur.com/zLEQG.png" alt="density plot with facet wrap"></p>

<p>How do I get the real density plot when using facet_wrap?</p>

<p>Here is the code:</p>

<pre><code> wacc &lt;- c(0.05,0.05,0.07,0.05,0.06,0.04,0.04,0.03,0.04,0.04,0.04,0.04,0.04,0.03,0.03,0.04,0.04,0.04,0.04,0.04,0.05,0.05,0.05,0.04,0.05,0.05,0.04,0.05,0.04,0.04,0.06,0.04,0.04,0.1,0.1,0.1,0.07,0.08,0.09,0.09,0.1,0.08,0.09,0.09,0.08,0.1,0.09,0.1,0.13,0.06,0.09,0.1,0.1,0.09,0.11,0.09,0.08,0.08,0.09,0.08,0.06,0.08,0.06,0.08,0.06,0.07,0.08,0.07,0.1,0.08)
sector &lt;- c("Telecommunication Services","Telecommunication Services","Telecommunication Services","Telecommunication Services","Telecommunication Services","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Utilities","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy","Energy")
df &lt;- data.frame(wacc, sector)
ggplot(df, aes(df$wacc))+stat_density()+facet_wrap(~sector)
</code></pre>