title: Add an image in background of a Histogram
body: <p>I am trying to add an image to the background of a histogram. I am starting to use R and i had this idea from the last point of this guide on ggplot2: <a href="http://r-statistics.co/Complete-Ggplot2-Tutorial-Part2-Customizing-Theme-With-R-Code.html" rel="nofollow noreferrer">http://r-statistics.co/Complete-Ggplot2-Tutorial-Part2-Customizing-Theme-With-R-Code.html</a></p>
  
  <p>This is the code i am using</p>
  
  <pre><code>library(ggplot2) 
  **library(grid)
  library(png)
  img&lt;- png::readPNG("logo.png")
  g_pic&lt;- rasterGrob(img,  interpolate=TRUE)**
  ggplot(Ruta1600, aes(x=Ruta1600$fvec_aprox_md, fill=Ruta1600$nivel_dif_exp_codigo)) +
    geom_histogram() +
    labs(x="fvec_aprox_md", y="Count") +
    xlim(c(0,3000)) +
    facet_grid(Ruta1600$nivel_dif_exp_codigo~Ruta1600$fh_natural_id)    +
    geom_vline(aes(xintercept=mean(Ruta1600$fvec_aprox_md)),color="black", linetype="dashed", size=1) +
    **annotation_custom(g_pic, xmin=5, xmax=7, ymin=30, ymax=45)**
  </code></pre>
  
  <p>And this the error i am getting:</p>
  
  <pre><code>Error in `$&lt;-.data.frame`(`*tmp*`, "PANEL", value = c(7L, 4L, 1L, 4L,  : 
    replacement has 415 rows, data has 1
  </code></pre>
  
  <p>I guess the problem is with the size of the image. I am still learning the basis of R, so excuse me if the answer to this question is too simple.</p>
  
  <p>Thanks.</p>